How to Change a Tube & Tire

Before you begin changing a flat on your bike, you will need to remove the wheel from the frame.

Chances are your tire has gone flat all the way. If not, unscrew the valve cap, and release any remaining air by pressing down on the valve core. If you have Schrader valves, press the valve core with a pointed object, as shown.
If you have Presta valves, loosen the tip of the valve, and press down on it with your finger. Then unscrew and remove the retaining ring from around the valve, as shown in the photos below.
You will now remove the tire from the rim. Begin by sliding one tire lever between the rim and the tire bead, with the curved end of the tire lever pointing down into the rim.
Repeat with a second tire lever, keeping the two levers 3-4 inches apart. Using the thumbs of both hands, flip the levers up and over, so that they are lying flat against the spokes, and the bead of the tire has been pried off the rim.
Secure one of the tire levers in place by hooking it around the nearest spoke, as shown.
Slide the other tire lever against the rim all the way around, until one bead is completely off the rim. If this is initially difficult, place the wheel vertically on the floor, and lean on the tire lever using the force of your entire arm. As more of the bead comes off the rim, it will become easier.
Pull the damaged tube completely out of the tire.
Some people advocate leaving the other bead on the tire on the rim. While this does make reinstalling the tire easier, I believe it does not allow you to thoroughly inspect the tire to identify the cause of the flat. Therefore, I recommend that you yank the tire completely off the rim, which should be fairly easy to do at this point.

Now take your pump or compressor, and begin filling the damaged tube to observe where the air is escaping. Inspect the tube, the inside and outside of the tire, and the inside of the rim to try to identify the cause of the puncture.

Once you have identified and removed the cause of the puncture, you are ready to install the new tube. Put a little air inside the tube, just enough to give it shape, and insert it into the tire. A little air helps the tube stay put inside the tire.
Position the rim with the valve hole toward you. Lay the tire with the tube inside it on top of the rim, and insert the valve into the valve hole.
Go all the way around the rim, and insert only the bottom section of the tire bead into the rim. Do not start on the top section of the bead until the bottom part is mounted all the way around.
When you get to the end of the bottom section of the bead, you may find it easier to pry it into the rim using your tire lever. You may also wish to release some air from the tube at this point by pressing down on the valve core. This will reduce the tension on the tire.
Make sure one side of the tire bead is completely seated around the rim before proceeding to the other bead.
Begin pushing the top portion of the tire bead into the rim, starting at the valve.
Work the top bead in all the way around the rim using your thumbs or the heels of your hands. Some tires will go in fairly easily.
If yours does not, use the tire levers to get the last 3-4 inches of the bead seated, as shown.
(NOTE: Some tire and rim combinations make an extremely tight fit, and even a skilled mechanic has to struggle to get the tire properly mounted. If you find that to be the case with your bike, by all means, look into getting  a different set of tires that will allow you to change a flat with less difficulty.)
Before inflating the tire, make sure the tube is securely encased inside the tire, and not being pinched between the tire bead and rim at any point.
Inflate the tire to the recommended pressure (embossed on the tire sidewall), reinstall the wheel, and you are ready to roll!