You need to look at the helmet's main elements:
The exterior plastic of a helmet is important to hold it together in a crash. Look first for cracks or abrasion on the surface that show evidence of an impact. Even if you think the helmet has never been impacted, look carefully. Many riders don't know they hit their head. Small cracks around the edges or anywhere else on the shell indicate aging and a need to replace.
Press carefully all over the helmet to see if you get a "beer can" effect where the shell can be pushed in and it pops back. Most cheap helmets show some of that when new, but that should be all over the helmet, and very little. If the shell dents more than a little bit, that indicates crushed foam underneath, and a need to replace. If there is crushed foam you would usually see abrasion of the shell where it indents. Note that more expensive helmets that are molded in the shell should have no beer can effect whatsoever. With those helmets any flat spot on helmet surfaces that were formerly curved would indicate damage.
Check the shell color for fading. The helmet below was ridden across the US by Brian Hanson. It was vibrant yellow when he started. With constant sun exposure it faded badly, probably from lack of sufficient UV inhibitors in the plastic. If your helmet fades, the plastic has probably become brittle, and it should be replaced. Brian replaced his.
Remove the fitting pads if they come out, and inspect the styrofoam liner carefully for any signs of cracks or compressed foam. If in doubt about a spot on the helmet, measure the foam thickness and that of an identical spot on the other side, or if you have another helmet of the same model and size, use that. If you discover any cracked or crushed foam, replace the helmet. Remember that EPS liners do recover some of the crushed thickness, but the foam that was compressed will not perform well in the next hit. Even if you find no damage, if you know the helmet has taken an impact you should replace it. The damage can be difficult to identify even with careful measuring.
If you have one of the few bike helmets with an EPP (Expanded PolyPropylene) or other multi-impact liner, do the inspection as described above anyway. EPP recovers, but not 100%. In time if you crash more than once you will find foam damage and need to replace your helmet.
Buckle and Strap
Check the straps on the helmet for signs of wear, and replace if they seem worn, faded or any of the stitching is beginning to fail. Salt accumulations should be washed out before inspection.
Check the buckle and replace if you see any missing parts. The plastic blades that lock into the female side of most buckles can break. The buckle will hold together weakly with one blade, but will fail in a crash.
The rear stabilizer on many of today's helmets is not really part of the retention system that holds the helmet on the head, but a means of adding some stability for comfort. It should still be inspected for structural integrity and to be sure the adjustment is working. Stretching or tugging it with moderate force will usually tell you that.
Some older helmets had impact protection as good as anything on the market today. If yours has a CPSC, ASTM or Snell sticker in it and passes the other inspection points, it is probably still a good helmet. If is is older than that, it should be replaced.
More on replacement
We have a page up on when you need to replace a helmet, with more detail on what makes it necessary.
In addition to cleaning a helmet when it is returned, the inspection steps are critical for renting. Many riders will not tell you when they crash, or will not think they hit their heads. With experience the steps above can be quickly done, but you must remember to do them each time.
Here is the info on this page as a helmet inspection checklist. in .pdf format for printing out.