A derailleur is often erroneously called a gear shifter, though that is, in fact, what it does. It is part of a bicycle’s drivetrain that moves the bicycle forward; this device moves the bicycle chain across the cogs in order to move it — or shift — to a higher or lower gear.
There are two classifications of derailleur: front and rear. A front derailleur attaches to the bicycle frame, most typically via a round clamp that attaches to the seat tube, or the vertical tube your seatpost slides into. It uses a metal cage to push the bicycle chain from the smallest cog on your crankset — also known as the front set of gears, usually a set of three — to the middle, and then onto the largest, and vice versa. The front derailleur is used to adjust, in large jumps, your pedal cadence from very easy to very hard.
A rear derailleur is attached to the rear right side of a bicycle frame adjacent to the rear wheel. It looks very different from the front version: while the rear derailleur has a cage, it uses a set of two pulleys to guide the chain through it. This system helps take up the slack in the chain when it moves from the largest cog on your rear cassette — or cluster of gears — to the smallest one. The rear verson is spring-loaded, just like the front version, to assist in this process.
The rear derailleur adjusts your pedal cadence in smaller jumps. As you use your handlebar-mounted shifter to move the derailleur from the largest cog to the smallest one, you will have to pedal harder to make the bicycle move. Therefore, the smallest cog in the rear cluster is your hardest gear and the largest cog is your easiest gear. The exact opposite is true for your front chainrings: the smallest chainring is your easiest gear and your largest chainring is your hardest. By using your handlebar-mounted shifter to move your derailleurs, you can adjust exactly how hard or how easily you want to pedal.
As a rule of thumb, never shift your rear derailleur into the smallest gear if the front one is also in its smallest gear, and vice versa. This is called cross-chaining and can damage both your chain and your cogs. If you are new to bicycling, shift your front derailleur into the middle chainring and leave it there while you learn to adjust your rear derailleur into any of the cogs on your rear cassette.