How do I prevent the rear derailleur from slipping gears?
What's the best way to tune the rear derailleur of my bike to stop slipping gears? It seems that every time I re-adjust it, the middle/upper gears are perfectly aligned, but the lower gears never stay put. When I'm climbing up hills, the chain keeps slipping up/down a gear, and never stays put.
Ok, a number of the other responses have captured some of the possibilities here. The possible causes and fixes I can think of are:
Worn Cassette, which is also usually associated with a worn chain. If this is the issue there are two key indicators that you will see. The first is that the gap between the teeth on the sprockets will look less like a "U" and more like a "V". The second is that the chain will measure more than 12.7mm between each rivet. Sheldon Brown has more information on this here. If this is the case, then the cure is to replace the cassette and the chain, and quite possibly the chain rings as well.
Bent Derailleur Hanger. When viewed from behind, the derailleur cage (with the two jockey wheels the chain runs over) should be vertical. If it isn't, you'll need to either bend the derailleur hanger (carefully) to the correct alignment, or replace the derailleur hanger (if it is replaceable). I wouldn't try bending the hanger myself - I'd take it to a bike shop.
Friction in the Gear Shift Cables. A bit difficult to tell if this is the issue, but realtively easy to fix. A temporary fix involves putting chain lube on the points where the cable enters and exits the cable outers and changing the gears around a bit. A better solution is to remove the cable from the outers, wash it with degreaser, clean and dry it, then re-fit it to the bike. If the end of the cable is worn, it can be difficult to re-fit it. New cables are pretty cheap, so you may consider replacing the inners and outers.
Weak Derailleur Spring. Unless you have a fairly expensive deraileur, you can't replace the derailleur spring. You can stave off the inevitable for a bit by cleaning and lubricating the derailleur, but ultimately this means it is time to get a new derailleur.
To add on to Mike's answer, slipping is probably due to your chain being old. As a result of your chain being old, it has probably worn down the teeth on the rear cassete (you should be able to examine it and see grooves and uneven wear on the gears you use the most). Replace both the chain and cassete, then get yourself a chain wear indicator and check it periodically to prevent your chain from destroying your cassete again.