So you get on your bike.. your riding along you get to a steep hill and shift, the shifter goes "CLICK" then your rear deraileur and cassette go "GRIND" "SCRAPE" "RATTLE" and you go nowhere....
As we pack more and more gears into our cassettes the space tolerances for your shifts need to be more and more precise. What this means for you is that as your shift cables stretch (even sligthly) the precision alignment of the derailleur and cassette will get out of wack.
So what do you do? It's actually quite simple. If you're mid ride and this starts to happen, in all likelyhood the cable has stretched, especially if it's new. To fix this simply look at the deraileur where the cable enters it. You will see an adjustable barrlel that can be turned.
Turn this adjuster to alter the alignment of the deraileur in relation to the cassette. If your cable is stretched you will want to go counter clockwise by 1/4 turn increments and then test it. If you make it worse... try going the other way, again in 1/4 turn increments. The key here is to be patient and eventually you will find the sweetspot where all your gears are working smoothly.
If you have an issue with getting into the top or bottom gears on the cassette, you might have to adjust the max movement screws. On the side the derailleur you will see these 2 screws.
Adjusting the one labeled H will affect how high the derailleur is able to travel (easier gears), while the one marked L will affect how low it can travel (faster gears). Simply increase the allowable distance that's causing you trouble. If you find that you are shifting right past the top or bottom gears, use these screws to back off the maximum travel so as to hit the limit while inline with the gear.