Know your drivetrain:
Your pedal movement rotates the crank arms, which turn the chain rings, which drive the chain, which rotates the rear sprockets and ultimately the rear wheel and propel you forward. You have three chain rings on the front and 7-9 gears on the rear sprockets (depending on whether your bike has a 21, 24 or 29 speed drivetrain). Different combinations of the front chain rings and the rear sprocket gears will make it either easier or harder to pedal, depending on terrain elevation and surface. The front and rear derailleurs do the job of shifting the chain to different gears.
The chain rings (also called “crank rings”):
Shifting the front chain rings is done using the left-hand shifter.
The smallest ring (the innermost one) is the slowest, easiest to pedal and used to climb or riding in rough or difficult terrain (sand, for example). The middle chain ring is harder to pedal than the smallest ring, but using the middle ring gives you choice of the full range of the rear sprocket. It is usually optimal to choose the middle ring if you are cycling on level terrain. The largest gear (outermost one) is the most difficult to pedal and should be used for going downhill at higher speeds.
The rear sprocket:
Shifting rear sprocket gears is done using the right-hand shifter.
You should have 7,8 or 9 gears on your rear sprocket. The higher numbers are more difficult to pedal, and vise versa. When riding in a terrain with variable elevations or surfaces, it is usually best to use the middle chain ring and use the rear sprockets to fine-tune your gear choice.
It is important to avoid “extreme gear” combinations (also known as “cross chain” combinations) which put the chain at a too large an angle from the frame. Therefore, do not put the chain on the smallest rear gear when you have it on both the largest chain ring and largest rear gear, or vise versa. The middle chain ring will give you the full rear sprocket range.
As a general rule, you should shift “before you have to”. This means that you should not wait until you get right to the section that requires shifting (difficult climb, fast descent , sand, etc), but rather you should shift early and before you actually need to shift. Anticipate the optimum shifting point in advance and make your choice of gears when you are still on easy terrain. Shifting when or after you get to the difficult section will strain your muscles and your drive train.
If you have to shift after the optimal shifting point (after you actually enter the difficult section), it is best to shift when there is least tension on the chain. To do so, pedal hard once to gain some momentum, then shift right after the power pedal stroke.
It goes without saying that it is important to keep your drivetrain components in good working order (derailleurs, chain and sprockets clean and properly lubed).