Assuming unworn and decently clean parts.... Most shifting problems are due to stretched cables. Shift into the highest (smallest) cog in the back and check the cable tension. It should be snug but not tight. Shift slowly through the gears. The chain should jump positively to each cog going up or down, and shouldn't make any noise once it's seated. If it's "hunting" to the next lowest gear, then your cable is too tight.
If it tends to fall down on to the next highest gear...It's too loose.
Another common condition is a slightly-bent hanger for the derailleur. Some of these are made of very soft aluminum, and must be checked frequently.