Check every link by bending the chain back and forth at the link. Conduct a visual inspection of the rear cassette and front chainrings. If either has excessive wear you should replace both the cassette, chainrings, and chain. Check that the rear derailleur hangs straight and vertical below the sprockets. If it is not straight it is recommended that you take the bike to a shop in your area to have it repaired.
Clean cables are essential to good shifting.
If the gear cables are excessively dirty or have rust on them they chould be replaced. Cleaning and lubricate the cables and the housing. Check the cable housing. If it is cracked, dirty, or bent. Replace cables and housing.