How do I tune up the shifters/derailleurs on my mountain bike? I have a Diamondback mountain bike with Shimano shifters that I bought used last summer, and over time the shifting has gone out of whack. For example, on the front wheel I can't shift into the easiest gear, and in some gears it sounds like the chain is rubbing on one of the derailleurs when I'm riding. Also when I'm in the hardest two gears on the back wheel, the chain slips sometimes.

I've tried adjusting the screws on the derailleurs and got the rubbing noise to go away, but it returned not long afterward.

I ride my bike to work but wouldn't call myself a cyclist. How would you explain to a child, step-by-step, how to tune up the bike's shifting? How do I know if a part needs to be replaced, and are there any parts in the shifting system that I should expect to have to replace after riding the bike 1000 miles?
You said to explain it as if to a child so here it goes.
Basic Shifter/Derailleur concepts: The derailleur spring is always pulling to the smaller ring(s). Assuming your bike has Trigger shifters since you said it was a MTB, the big thumb lever will push the derailleur to the bigger ring(s). This is true for both front and rear (left and right respectively). The trigger is basically a "catch release", letting the spring pull the derailleur to the next smaller ring.
Setting the Rear Derailleur (RD):
Preferably with the bike in a stand, but can be done upside down, get the RD into the smallest ring (pull trigger until it stops clicking).
Start turning the pedal with your one hand and push the thumb lever to shift to the next bigger ring. If it shifts smoothly and quickly, push the lever again, etc.
If, after you shift, the chain doesn't bump to the next cog, find a barrel adjuster and turn it as if you were loosening it (CCW) while still turning the pedals. You are, in essence, lengthening the cable and pulling the RD toward the bigger cog (inboard).
Once you get to the biggest cog, pull the trigger so that it starts to shift toward the smaller cogs.  If it doesn't drop down, you'll have to turn the barrel adjuster as if you were tightening it (Clockwise) effectively shortening the cable and letting the spring pull it farther outboard.
Front Derailleur (FD):
The process is similar to the RD. Shift so that it's in the smallest ring (pull the trigger).  Once there, inspect the cable.  Note how much slack there is. If the cable has a lot of slack (no tension), try to find the barrel adjuster and turn it CCW (loosen/lengthen) until there's only a very slight amount of tension. If the cable it still taut, I like to shorten the cable (turn Clockwise) until there's very little tension.
From there, turn the pedals with one hand and push the thumb lever on the left shifter.  If it goes to the next ring, sweet.  If it's having difficulty, I stop pedaling, turn the barrel adjuster CCW, then shift back to the small ring (pull the trigger), then start pedaling and push the thumb lever again. Repeat until it shifts cleanly.
Adjusting the limiters:
Both RD and FD have limiter screws that limit (obviously) the boundaries of the the derailleurs.  They will most likely be Phillips head. 


They keep the RD from going into the spokes or dropping the chain between the cassette and the wheel. On the FD, they keep the chain from dropping in off the small ring or out off the big ring.
FD: Shift to your hardest gears in front (biggest ring) and back (smallest ring). Many derailleurs will label the screws with "High" or "H" and "Low" or "L". High = Hardest/Outboard, Low = Easiest/Inboard. The way the gears are now, you'll be adjusting the "H" screws.  If they aren't labeled, you'll have to look and see which screw is actually hitting, or nearest to hitting, another part of the derailleur. Adjust the FD so that the outside of the FD is about 1mm from the chain or as close as you can get it without rubbing. (The latter for cheaper cranksets that develop wobbles in the chainrings).  Adjust the RD so that the cage and pulleys are parallel with the smallest cog.
Now shift so that the RD is in the Biggest Ring and the FD is in the smallest. This is your easiest gear or fully inboard.  Now using the other screw ("L"), again, adjust the FD so that there's about 1mm space between the derailleur and the chain or until there's no rubbing.  Adjust the RD so that if you pull the cable with your hand it moves no more than 1/2 the width of the chain.  Just enough so that it can shift to the big cog easily and stay there effectively.
If there are still issues, there could be other things at play. You might have to replace housing or cables.  Maybe your RD hanger is bent.  Maybe your FD is askew

Hope that helps.