Speed is not the focus with mountain bikes as you would not expect to go very fast in rough terrain, rather control is the main focus and to provide a stable journey through this rough terrain. In order to buy a good mountain bike, one should consider these things first.
The first thing to consider is the budget, you can have anything from 50$ to 10,000$ with mountain bikes. As the cost increases, so does the quality and features. But in most cases, a decent bike can be purchased for less than 500$, which is helpful in the event of a strict budget.
There are 3 major categories of mountain bikes, i.e XC, All Mountain/Trail, Downhill. Survey the area first where you will be riding the bike, what kind of area is it? Is it rough terrain? Is it downhill? Or a mix of both? If you spend most of your time riding local trails and perhaps make 1-4 trips per year to declining terrain, then a downhill bike may not be the best option. A decent trail bike will do just fine in this case, and you could rent out a downhill bike when needed.
The material the frame is made up of, will decide the weight and durability of the bike. Steel is the most common material, its sturdy and durable but its also quite heavy. Aluminum has gained a lot of popularity with mid range bikes, it is lightweight and strong. It is also flexible which allows a more comfortable ride. Titanium has the sturdiness and durability of steel and the weight of aluminum, you will find it with higher end bikes as it is difficult to work with. Carbon fiber is used in the top tier bikes, it can take a lot of punishment and are extremely light. However if the rider is heavy then they should look into a metal frame rather than a carbon fiber one.
Mountain bikes have bot rim and disc brakes. Disc brakes provide a more accurate and strong stopping force but are more expensive.
Suspension is found in the front, rear or both ends of the mountain bikes. If the terrain to be ridden on is bumpy and more aggressive then a substantial suspension system is needed.
Material, spokes, width of the hub are some of the things to consider here. The aggressive the terrain, the stronger the materials of the hub should be chosen.
Saddle and Shifting System:
Since the rider will encounter many bumps along the way, a comfortable saddle is paramount here to ensure a comfortable journey. With shifters, different kinds are available for different uses. The choice should be made here depending on the need of the rider and terrain.