Before you head out on your next ride, make sure your bike is outfitted correctly. If you've just recently purchased a mountain bike, then odds are it is bare. It won't have any of the accessories that make for a safe and comfortable ride.
Before we get started discussing what you should go out and get, make sure you have the most important accessory of all: a helmet. When you brought your bike you should have also purchased a helmet. If not, then this is the first thing you should get.
Alright, now let's take a look at the other accessories.
One of the worst things that can happen when out trail riding is that your tire will become deflated. If this happens, and you don't have a pump, you will have to walk the bike back to the trailhead.
In order to avoid this hassle get a tire pump. There are small pumps that are designed to attach to the bike frame. They are much smaller than the large tire pumps that you use at home. If you have a cargo bag, you could even store them in the bag instead of on the bike frame.
Spare Inner Tube
Sometimes a flat tire is blown and not simply deflated. You can't simply inflate it with a pump. For this problem you will need a spare inner tube. You will need to remove the tire and take out the inner tube. You should always move off the main trail when doing this so other riders don't collide with you. Then turn the bike upside down so that you can easily remove the tire.
You will need several items for this: a tire lever, a new inner tube, and a tire pump. If your tire pump does not have an integrated pressure gauge, then you will need a separate pressure gauge.
You should keep the tire lever and extra tube in your tool bag (described below).
Here is a video illustrating the exact procedure for replacing an inner tube while on the trail.
A small tool kit is essential. You won't be able to do repairs without the proper tools. You can get a tool bag that is already filled with the most common tools. These bags can be stored under the seat or, if you have a luggage rack, on the rack.
Make sure that the tool bag contains a tire lever, a set of Allen wrenches, a tire patch kit, and an extra inner tube. Additional items you might want to include are a tiny flashlight, a shop rag for dealing with greasy chains and dirty tires, and chain lubricant. Look around for the best mountain bike accessories.