No matter what type of bike you ride or what type of riding you do with it, your drivetrain will have better performance and longer life when you shift properly.
Shifter (or shift lever) - this is the control mechanism that is operated by the hands of the rider
Derailleur - this is the mechanism that physically moves the chain across the gears
Shift cable - refers to the control cable; the inner cable is the actual metal cable, which is covered in part or fully by the cable housing (or outer cable)
Up shift - to shift into a higher gear; slow RPM (revolutions per minute)/ high speed.
Higher gear - higher gears have more resistance; "mashing gears"
Down shift - to shift into a lower gear; fast RPM/ low speed
Lower gear - lower gears have less resistance; "spinning gears"
Chainring - the toothed sprockets on your crankset (by your feet)
Cassette/freewheel - the toothed sprockets on your rear wheel; freewheel is the older style and cassette is the modern style; both are still commonly used.
Rear derailleur - The rear derailleur works by moving the chain laterally across the cassette/ freewheel by means of the shift cable and the shifter. The rear derailleur functions with a parallelogram which keeps the cage vertical and two pulley wheels which pick up the slack in the chain to keep it tensioned. Due to their design they take some of the tension off the chain where it interfaces with the cassette/freewheel. This helps keep shifting smooth.
Front derailleur - The front derailleur has a very difficult job. It moves the chain laterally across the chainrings, also by means of a shift cable and shifter. The front derailleur uses a metal cage and a parallelogram which keeps the cage vertical. The front derailleur must move the chain across the chainring under full tension without the aid of any pulley system.
Internally-geared hubs - Internally-geared hubs switch gears in an enclosed mechanism by means of planetary gears connected to a shift cable and a shifter.
On derailleur bikes: The chain will only shift when pedaling forward--not while coasting, while the bike is at a stand still, or while back-pedaling. Shifting will be much improved by letting off some pressure on the pedals at the time of shifting.
On internally-geared bikes: The hub will shift when pedaling forward, coasting, at a stand still, or while back-pedaling. Smooth shifting is dependent on letting off pedal pressure at the time of shifting. Some of the modern internally-geared hubs are able to shift with some pressure on the pedals, but the internal assembly will have increased performance and longevity if you ease up the pressure.
Proper shifting will improve your bike’s performance and increase the lifespan of your drivetrain.
Change gears regularly. The ideal is to maintain a comfortable cadence with a comfortable amount of resistance no matter the situation. Strong tail wind: shift up and ride fast at a comfortable cadence. Steep hill: shift down and ride up slowly at an equally comfortable cadence. Maintaining a relatively constant cadence will improve stamina for more enjoyment on longer rides. Utilizing all of your gears also helps spread out the work load that any particular gear has to perform and that spreads out the wear that any particular gear will endure.
Match gears for good chainline. You can cut down on annoyances like chain rub if you keep your chainline in mind. Avoid cross-chaining: this is when your chain is in either the outer or inner chainring up front and crossed over to the opposite gears in the back. When you have your front derailleur set up in the low gear, you should also have you rear derailleur set up in the low range of the cassette/ freewheel and when you are in the high gear up front you should be in a high gear in the back. It can be especially problematic to run your chain from the small chainring in the front to the highest 2 or 3 gears in the back. Keeping your shifting pattern to combinations with good chainline does not generally limit your gearing possibilities because most cross chained gears are duplicates or near duplicates of gears with an appropriate amount of chain deflection (or good chainline).
Spin, don’t mash. Spinning refers to pedaling at a high cadence with less resistance. Mashing is just the opposite, low to mid cadence with high resistance. Spinning is not only a better workout for your heart, but also greatly improves the performance of your shifting, and cuts down on the scary noises your drivetrain can make when forced to work under a great amount of pressure. This is not to say that your feet should be flying around at an uncomfortable rate! Remember to look for the gear that allows a comfortable cadence with a comfortable amount of resistance. The chain will shift better when moving quickly and without uneccessary pressure.
Lighten your pedal pressure. This is an often overlooked aspect of riding. The derailleurs perform a difficult job: moving the chain while it is being used to propel the bike requires a lot of force if you keep a lot of load on your pedals. So, ease up a bit when you shift, especially when shifting the front derailleur which does not have the aid of the pulley wheels like the rear derailleur does. When shifting under full load you are causing your derailleurs to work harder than they need to and this leads to the pivots getting sloppy and wearing out before they need to. Shifting under full load also strains your chain to an unnecessary degree. It will also put more strain on the teeth of your chainrings and cassette/freewheel than they need to be dealing with. This all leads to less-than-optimal performance and faster wear of your components.
Shift preemptively to low gears and shift responsively to high gears. One good tip to make all of these behavioral changes work well is to anticipate any upcoming changes in riding condition. If you are biking up to a steep hill then you should down shift before you have to start climbing. This is shifting preemptively. On the other hand, you should not up shift preemptively as that would lead to excess resistance. So, when you crest the hill, stay in the low gear until your feet start spinning, then up shift for a better gear with a comfortable cadence.
Shift into a low gear for stops. With the preemptive down shifts in mind, don’t forget that when you are coming up to a red light on your commute to work, you should down shift into a low gear. This way, when you begin to pedal again, you won’t have to put all your weight onto the pedals to get the bike to respond. This is one situation where your bike's drivetrain can really wear out quickly by staying in a high gear.
Keep these things in mind when riding. If you are not used to riding this way it can be a bit of work trying to keep up with all the rules, but once you get it down it will begin to happen naturally and improve your ride: more fun, less work, better cardio work out, longer-lasting drivetrain!