Necessary Tools
You'll need a rag, a phillips screwdriver, a 5mm allen wrench, as well as a light oil like Triflow or Phil Wood Tenacious oil.
How They Work
Rear Derailleur Parts
Almost all modern derailleurs function the same basic way. They are designed to move (or derail) the chain from sprocket to the next. The upper guide pulley (or jockey pulley) moves the chain in both directions. For example, when you need to climb a hill, you shift down to a lower gear. This pulls the shift cable and forces the guide pulley to change to a bigger sprocket. When you need to go faster, you fine-tune the shifter to a higher gear. This releases shift cable tension and allows the derailleur springs to pull the guide pulley back down to a smaller gear. Each time you shift gears, the length of chain changes. The lower tension pulley is spring-loaded to take up this slack.
Limit Screws
There's three alteration screws the B-Screw (B-tension alteration), the H-Screw (high gear limit cease) and the L-Screw (low gear limit cease). Adjustments on these screws ought to always be made in 1/4 turn increments.
B-Tension Alteration
The B-Screw controls the derailleur body's angle in relation to the sprocket-set. Shift down to the largest sprocket and check the distance between the guide pulley and the huge sprocket. If the guide pulley is rubbing on the sprocket, tighten the B-screw clockwise to increase tension and move the pulley away from the sprocket. If there is a immense gap between the pulley and sprocket, loosen the B-screw until the pulley rubs the sprocket, and then tighten it until it clears.
High Gear Limit Cease
The H-Limit screw high gear limit cease prevents the guide pulley from shifting any further past the highest gear and in to the axle. In order to fine-tune it properly there has to be no tension on the lower inner cable. In case you feel tension, loosen the cable adjuster until there is none. Now check from behind how the chain is riding on the smallest sprocket. If it looks like it desires ride off in to the axle, tighten the H-screw clockwise until it lines up. If it looks like it is rubbing on the next gear, loosen the screw until the chain is nicely centered on the sprocket. Now re-adjust the cable tension until the derailleur shifts smoothly down to the next gear.
Low Gear Limit Cease
The L-Limit screw prevents the guide pulley from shifting any further past the lowest gear and in to the wheel spokes. Shift down to the lowest gear, step behind the bicycle, and check how the chain rides on the sprocket. If it looks like it wishes to ride in to the spokes, tighten the L-screw clockwise until it is centered on the sprocket. If it looks like it wishes to shift down, loosen the screw until it lines up. As an additional precaution you can use your thumb to gently push the derailleur body and make sure the chain won't run in to the spokes, as this might obviously have a disagreeable effect on both you and your bicycle.
Cable Adjusment
The cable tension adjuster defines how far up or down the derailleur moves. Step back so you can see the chain & sprocket alignment, & then through the gears in both directions, first shifting up & down, & then down & up. The chain ought to look centered on each sprocket. If it is rubbing on a bigger gear it means there is much tension on the cable. Loosen the stress by turning the adjuster clockwise. If it wishes to jump down to a smaller gear it needs more tension. Increase the stress by turning the adjuster counter-clockwise.
You can also use sound to check the modification. There is always a base-level of noise that can be heard in every gear. This noise will increase in a slightly different way depending on which way the stress is out of modification. If there is much tension you will listen to a metallic rubbing sound, but if there is tiny tension you will listen to a clicking noise as the chain tries to jump to a smaller sprocket. There is usually a cable tension adjuster on your shift lever. With practice it is possible for you to to make little cable tension adjustments while you are riding.
Lubrication
Now that the derailleur is adjusted, always apply a drop of lubrication to the derailleur's plenty of moving parts. This will help prevent wear from dirt and rust, and it will keep your gears shifting smoothly. Wipe away any excess lube and take your bicycle for a check ride to make sure all the gears are working smoothly.