Bicycle gears are advantageous because they allow the user to adjust the difficulty of the ride. Gear selection is a personal preference based on the ability and riding style of the cyclist. However, learning about gears and your bicycle's drive train will in turn allow you to become a more proficient cyclist.
First, familiarise yourself with terminology and how bikes operate. The crank is the part of the bike to which your pedals are attached; the crank looks like a large cog with two arms extending in opposite directions--these are crank arms. The front derailleur sits just above the crank and will shift your primary gears. The rear derailleur is located behind where your frame meets the centre of your rear wheel. The rear derailleur will shift between your secondary gears. The series of gears attached to your real wheel is known as a cassette. The bicycle chain is what allows for the transfer of power from the crank to the rear wheel. Now that you are familiar with the terms and the basic concept of your bike's shifters, you can learn to properly use your gears.
Next, determine the type of shifter that your bike is equipped with. Some mountain bikes come equipped with twist shifters (usually higher-end), while most come with trigger shifters. Trigger shifters are always located on the handlebars near the brakes. As with the brakes, each side of the handlebar corresponds to a derailleur. The left shifter corresponds to the front of the drive train, the crank, just as the left brake lever corresponds to the front brakes. The right shifter corresponds to the cassette, just as the right brake level corresponds to the rear brake. Operation of trigger shifters varies by manufacturer, but generally there are two levels. The more prominent level will shift up, and the smaller level will shift down. To shift, simply depress the lever. Twist levers are located at the ends of the handlebar and correspond to the derailleurs as trigger shifters do. To shift, simply twist to the desired number of the gear you wish to select.
The smallest front gear is the easiest, and the largest gear is the most powerful. By contrast, the smallest gear on the rear derailleur is the most powerful, whereas the largest rear gear allows for a faster cadence (revolutions of the crank). It is best to use the more powerful gears on flat surfaces as each stoke of the pedal will transfer more power to the bike, causing it to move faster. When travelling uphill, it is better to use the faster gears for a more rapid cadence. You might be able to power up hills, but will expend more energy than necessary in doing so. It is best to practice using your gears frequently so that you can determine which gear selections to make for any given riding condition.
Practice changing gears so that you can find which selections are best suited for you. Keep your chain well lubricated. If your shifters are slow or unresponsive, contact your local bike shop as soon as possible.
Never shift when riding uphill or while stopped. Always wear a helmet when riding a bicycle. Practice shifting in a safe area such as a parking lot before shifting in the street or on the trail.