Mixing delicate electronics, high operating temperatures, powerful batteries, mud, rain and regular crashes isn't easy. Yet reliability is absolutely vital, as light failure at speed on technical terrain is no joke.
Make sure you can position the light where you want it, and that it'll do the job. Spot lamps are no use solo on tight singletrack, and a badly placed helmet light will drag your lid down or wring your neck.
Obviously budget is a big factor here, as is what level of light you find comfortable to ride with. A good 3W LED or 10W halogen light with a semi-focused beam is the minimum for safe riding on trails you know well. A normal HID lamp is so bright it pretty much gives you 'access all areas'. However, boosted HIDs or double sets can actually give too much light, and you'll be fighting to see through reflected glare and drowned detail, particularly in damp, muddy or misty conditions.
The longer you ride, the more battery run time you'll need. Most brands sell extra batteries (often at a discount if bought with the light)
A great lamp is no use if you can't fit it to your bar, or it just wobbles and points the wrong way when you do. Most mounts use clips and spacers but O-rings are a great simple solution.
Bike lights are now well beyond normal bulb technology. HID bulbs are the brightest by far but they're fragile and very expensive to replace. LEDs are super tough but even mid-power ones get seriously hot so output is often limited.
The latest lights use either cheaper NiMH batteries or lighter and smaller Li-Ion batteries like those in your phone and laptop. The bigger the battery capacity, the longer you can play out at night.
The silver dish around the light is responsible for providing a clear and consistent beam pattern. Most lights use a 10-15 degree flood pattern, while 5-10 degree spotlights give a more intense but smaller bright patch.