How to Change a Flat Bike Tire
1. Have the right gear. To change a bike tire, you'll need a tool called a tire lever, a new bike tube (aka inner tube) that fits your tire size and a bike pump. The inner tube size is embossed on the tire sidewall -- check that before you buy your tube. You can use a screwdriver or other form of lever, but you risk damaging the rim.
2. Take the wheel with the flat tire off. Release your brakes and flip your bike over. Find the axle. If your bike has a quick-release axle, flip the quick-release to the open position and loosen the bolt, but don't completely remove it. If your bike has a through-axle, loosen and remove it by opening the lever and turning it counter-clockwise. Once the axle is loosened or removed, lift your wheel out of the fork and set it down where you can work on it. Be mindful of your brakes as you remove your wheel.
3. Remove the tire. Using the flat end of your tire lever tool, remove the tire from the rim. Slide the tire lever along the rim, beneath the "bead" of the tire, as seen in the picture below. A tire bead is the stiff edge on your tire that keeps it in place on the rim. You also can use your hands to gently pull the tire away from the rim. If the bead is loose enough, you may not even need a tire lever.
4. Check the tire for sharp objects. When your tire is removed, check for any sharp objects that could have caused the flat. If you find any lodged outside or inside the tire, remove them to avoid another flat. You can remove the tire completely to do this, or leave it on the wheel with the beads removed from the rim (as seen below).
5. Replace the damaged tube with a new one. Remove the damaged inner tube by slipping it between the tire and the rim (if tire is still on wheel), or removing it from the tire (if tire is totally removed from wheel like in picture below).
Install the new tube by putting one edge of the tire back on the rim and slipping the new inner tube inside the tire. Begin the tube installation at the valve; place the tube's air valve into the machined hole in the rim, and then work your way around. After the tube is installed, roll the loose side of your tire into the opposite rim, being careful not to damage the new tube. Make sure the tire is replaced in the correct tire rotation direction. You can find the tire rotation direction on the sidewall. Keep the damaged inner tube in case you can patch it and re-use it.
6. Inflate the tire. Find your tire's recommended psi on the sidewall, and feel free to adjust the pressure to your liking. Attach your pump to the air valve stem and begin to pump. Keep in mind that there are two types of valve stems (Presta and Schrader), and your bike pump needs to be appropriately compatible. Before you inflate the tire completely, stop mid-way to check that the inner tube isn't being pinched by the tire and the tire is properly seated on the rim. Then, finish pumping your tire to your desired pressure.
That's it! Practice changing a bike tire at home so you can quickly and confidently change it on your own the next time you're miles away from home with a flat.