There are few activities you're likely to do in your life where a helmet is more important than when you're on a motorcycle. Think about it - compared to when you're in a car, a motorcycle accelerates faster, generally has a higher top speed, is inherently less stable (if you hit a patch of ice in a car, you might do a pirouette if you're lucky - on a bike, you're skating across the tarmac), is less visible in traffic, and (with extremely few exceptions) has no crash protection worth mentioning. Finally, there is rarely such a thing as a 'small' motorbike accident. In other words, any protection you get in case of an accident is based on whatever you wear - boots, leathers, and a helmet.
A few words about motorcycle accidents
Obviously, the best possible outcome of having a helmet is not needing it. However, for all the reasons described above, motorcyclists are particularly vulnerable, and do have a lot of accidents. It doesn't matter if you are the most observant, passive motorcyclist in the world: There might always be some idiot out there who fails to spot you, with nasty consequences. In the UK, failing to be seen happens so often that it has its own name; a 'SMIDSY' - short for 'Sorry, mate, I didn't see you'.
Anyway, when you come off your bike, there are typically two main types of accidents; those involving other vehicles, and those not involving other vehicles. If other vehicles are involved, the accident generally involves crashing into something, flying for a bit, landing, sliding for a bit, and then stopping. If no other vehicles are involved, it's generally coming off the bike, sliding for a bit, and then stopping, hopefully without hitting any trees or other relatively solid objects in the process.
Either way, your helmet has to protect you from an impact (which, statistically speaking, will be either against a part of a car, or against the asphalt), and abrasion damage (as you slide along the road for a bit). Finally, your helmet should be smooth enough to not snag on anything - if it has ventilation inlets etc, these should break off as you hit the tarmac, because if they don't, and your helmet ends up snagging on anything, it'll snap your neck like a dry twig - with a broken neck, it doesn't really matter if your helmet protected your head...
Basically, a helmet has a hard outer shell which stops sharp pointy bits from sticking into your brain, and which protects you from abrasion.
It also has a softer inner layer, which is often made of polystyrene (yup, the same stuff as the coffee cups, just compressed in a different way) designed to bring your head to a stop as slowly as possible - in effect, it's a crumple zone between your head and the inside of your helmet. These inner layers come in different stiffnesses. "If a helmet is too stiff it can be less able to prevent brain injury in the kinds of crashes you're most likely to have. And if it's too soft, it might not protect you in a violent, high-energy crash." (http://kamps.org/g/?zyof)
Types of MC helmets
There are a few different types of motorcycle helmets. A full face helmet is the type which you probably associate with motorcycle racing - it has a visor, and covers all of your head. An open-face helmet protects the sides, back, and top of your head, but leaves your face behind a plastic visor. A flip-up helmet is a combination of the two, where the chin-bar part of the helmet can flip up (great for motorcycle instructors and police officers, as it is easier to communicate when there isn't anything in the way of your face). When flipped down, the helmet offers chin protection, but due to the hinging mechanism, it isn't quite as safe as a full-face helmet.
There are other types of helmets as well, such as a skull cap etc (often seen on Harley Davidson riders), but seeing as these are practically useless, they won't be covered any further here.
Choosing a helmet
There is an old adage in motorcycling that goes 'if you've got a £5 head, get a £5 helmet'. There's something in that, but seeing as helmets cost up to £700, thinking that expensive automatically means better protection isn't necessarily correct.
A lot of focus is placed on helmets, but the truth is that even a cheaper helmet (as long as it passes certain safety criteria) generally gives enough protection in an accident: As it turns out, most accidents where helmet-wearing motorcyclists sustain enough head trauma that it kills them, even the most expensive, best helmet in the world wouldn't have helped, as the damage to the rest of their body (back, torso, and neck, especially) would have killed them anyway.
You would be forgiven for thinking 'hey, the MotoGP guys use helmet X - if it's good enough for them, it's good enough for me'. Which might seem reasonable, until you think about what these guys go through: Motorcycle racing is done in a beautifully controlled environment: Even if you're going at 180 mph, it's possible to survive a crash. Why? Well if you come off your motorbike in a race, it's generally in a turn, so you may go flying for a bit, but you then land on asphalt, and slide on asphalt, grass, sand, and end up in a stack of haybales. With all the body armour these guys wear, it can mean broken bones and being seriously winded, but generally, it's not really worth worrying all that much about. On the road, however, the situation is quite different: There are cars, sharp kerbs, buildings, trees, sharp pointy things (fences etc), traffic light poles, etc.
What I'm getting at, is that it's important to choose a helmet that is suitable for the kind of environment you are likely to crash in. You're unlikely to survive a crash doing 150 mph in an uncontrolled environment (due to trees and other traffic, mostly), and it's generally illegal to go that fast, most places, anyway. For those reasons, it's relatively pointless to buy a 150mph-certified-kevlar-racing-helmet.
More realistically, you'll be going about 50mph, being cut off by a taxi, crash into the side of it, fly over its bonnet, bounce off the roof, and land ungracefully on the edge of a kerb, before sliding into a phonebox, which smashes into pieces, showering you in broken glass.
So, no racing helmets, unless you are, er, racing.
Also, open-faced helmets are a Bad Idea. Sure, you'll look cooler on your little Vespa, but there are regular reports of people who note that their chin bar and visors have started melting from the heat and friction of even a relatively undramatic crash. Melting fibreglass is probably preferable to leaving half your face along the road, so choose a flip-style or (even better) a full-face helmet.
The construction of the helmet is less important - they come in all sorts, from plastic and fibreglass to kevlar and carbon fibre. If you do a lot of long-distance riding, a lighter helmet might be a good idea (so a more expensive carbon fibre helmet might be a good idea), but apart from that, it doesn't really matter all that much: if it adheres to the appropriate safety standards (see below), you're good to go.
One last thing worth considering is ventilation and noise - more expensive helmets tend to be quieter and better ventilated than cheaper models, so for comfort and long-distance touring, it's worth looking to the more expensive and better-known brands.
Basically, a helmet needs to be as tight as it can be without giving you a headache. To really get a feel for it, select a helmet that seems to be snug, then wear a smaller size for about 10 minutes. If you can bear it for 10 minutes or so, you've probably found the right helmet size for you: It'll loosen a little bit as you wear it in, anyway.
Safety markings / certificates
In the US, expensive helmets are tested and marked by the SNELL foundation - but the tests used here are debated, and many physicists and physicians argue that the tests are too academic, and not realistic in the real world - which means that manufacturers creating helmets to pass the SNELL tests, are, in fact, creating helmets that are dangerous in real motorcycle accidents (see http://kamps.org/g/?zyof).
In the UK, a new government-appointed test body have developed the SHARP test (see also http://kamps.org/g/?ikrh), which gives motorcycle helmets a rating from 1 to 5 stars. These tests are designed to closely reflect 'real life' motorcycle accidents, and so should, at least in theory, be the most useful rating system we have for MC helmets to date. It's worth noting that expensive helmets (such as the £500 Arai RX-7) don't necessarily fare all that well, whilst some cheap helmets (Such as the £60 Lazer LZ6) get a full score, and would be safer in the real world.
Different countries have different mandatory safety markings for motorcycles: In Britain, all road legal motorcycle helmets must conform to ECE 22-05 or the older British Standard 6658, and will have markings identifying such conformity. Other countries have other markings, so check what is required for you in your country.
One last note - when you buy a motorcycle, make sure that you replace it if it is dropped (even from a small distance), or after 5 years - helmets do deteriorate over time, and it's about your life, after all...
Re the write-up below: Barring a few points that don't sit well with me, everything the man says is true. Choice of helmet should probably also be influenced with the roads you ride on. I ride a small-engined (125cc) scooter that does 75mph with a hind-wind, down-hill, so I am not at risk of a high-speed impact. I do, however, ride in inner-city London, arguably one of the most congested cities in the world, during rush-hour (this route every day, plus whatever I decide to do in addition..), which means a high risk of a low-speed (under 40mph) impact against a car, van, or other motorbike.
The first (and only, knock on wood) time I came off my bike, I was wearing a cheap Lazer helmet, and it saved my head and my face, without a doubt. Your mileage may vary, but my personal choice is pretty easy: I'll never be caught out without a full-face helmet.
One final point: Do a search on YouTube on MotoGP accidents (or just motorcycle accident). You'd be surprised the kind of stuff people shrug off and walk away from. Take especially close note of how and how hard the bikers hit the tarmac with their heads. Pretty amazing stuff. Also note what type of helmets they are using.