Not every mountain bike is used in the same way, so the exact bike you want depends heavily on what you plan to use it for. As a general rule, the more aggressively you plan to use the bike, and the more difficult the terrain you plan to ride over, the more advanced features you'll want on your bike. Of course, there's the corollary of that rule: More advanced bikes are more expensive. You'll find the perfect bike for you at the point where your needs and your budget intersect.
Choosing a mountain bike is a constant compromise between features, weight and cost. For example, a titanium frame is light and strong, but pretty expensive. A front suspension adds weight and cost, but is very advantageous on many terrain types. A full suspension (both front and rear suspensions) adds more cost and weight, but may only be useful to the most hardcore riders. (Take a look at How Mountain Bikes Work for more information on suspensions.) One thing all serious mountain bikers will tell you: Don't buy a low-budget mountain bike at a big box store or online. They may be cheap, but they're a waste of money. Expect to spend at least $400 -- and you may have to compromise on quality. In fact, some mountain bikers spend more than that on their wheels alone.
Another factor to consider is the amount of time you're willing to spend on bike maintenance. Bikes with suspensions and other advanced components have additional opportunities for mechanical failure, which some riders might consider a disadvantage compared to simpler, though less effective designs.
Size is very important. Sizing a mountain bike seems more like an art than a science. You have to consider your height, the amount of clearance between your crotch and the top tube, whether you'd prefer to sit upright or leaning forward (which in turn depends on how you plan to use the bike) and the length of the cranks. The simplest sizing advice is to never buy a bike until you've taken it for a test ride at your local bike shop. If it needs adjusting, they can help, and if it just isn't the right size, they can suggest a bike with a better fit.
In the next section, we'll help you frame your choice of bike by picking the best chassis for the job.