Several ways:
1) If you see radial steel threads....ur past illegal and safe!
2) wear bar in tread.
3) depending on jurisdiction (uk for example), minimum 2mm of tread depth. Any less = illegal.
4) Age (3 years is my cut off)
5) Greasy oily bluish green look (the same as you find in puddles with oil in them). This means they have gone through way too many extreme heat cycles and natural tire oils have been excreted to the surface, making the rubber less elastic, pliable and grippy. This can come from sub zero storage over the winter, and will effect tire performance; perhaps perfectly fine for the street, but reduced max capacity by 20 to 30% on the track, no matter how hot you get them again. Certain tires like Pirelli Super Corsas (mostly for track use but barely street legal), have no more than 5 to 10 useful heat cycles in them, after that and they are extremely reduced in performance for even the street!!! Check with tire specs on heat cycles and temp range. The longer the wearing, the less grip, harder, and more heat cycles they can take. The softer and more track orientated, the quicker they wear, the grippier (for a time), and the less heat cycles they can take. Tires like Pirelli Diablo Corsa 3s or Corsa Rossos are the best for street and track with several thousand heat cycles. But upgrading to Super Corsas radically reduces heat cycles down to 10 or so, but can gain up to 2 seconds per lap, depending on skill of rider.