Tools for the job: An innertube of the correct size and valve type. A pump. A floor pump is the fastest but any pump will do. Two tyre levers. (spoons will do in an emergency, ask your grandma first) 14 or 15mm spanner, for bikes with wheel nuts only. Puncture kit, incase you flat again.
Get those brakes out of the way Unless your tyre is a flat as a lake, you may need to undo the brake to be able to remove your wheel. Road caliper brakes have a small lever that opens the brake further, on some older road bikes this is found on the lever. With V-brakes, the silver bendy pipe thing can be released by squeezing the brakes arm together with your fingers and unhooking it. Cantilever brakes are similar too, squeeze and unhook. If you’ve got disc brakes, you didn't need to read this because you don't need to do anything.
PREPARE the rear wheel Flat rear tyre? If your bike has a rear derailleur, click into your hardest gear (smallest cog on the back wheel). If your bike is singlespeed or hub-geared, undo the wheel nuts and let the wheel slide forward to slacken chain, some wheels slide out forwards and some backwards, follow your nose as to which yours is. For internal gear hubs you'll have to remove shift cable or chain and possibly undo coaster brake arm from the non-chain side. In short, your wheel has to become separate from your bike so any cables/bolts have to go.
Get hung up, or flip out You can either hang your bike by the seat on a gate or low hanging branch etc (get creative). Otherwise it is common practice to flip it on its back like a dead ant. This would be a good time to take off your pannier bags if you haven't already. If you're on concrete, watch out you don't scratch up your nice Brooks saddle or bell. Grass is best.
Whip it out! Undo the quick release lever. Sometimes you also need to unscrew it a few turns to let the wheel come out. you can do this by holding the quick release lever and unscrewing the round nut on the opposite side. Lift the wheel out. For the rear wheel, pull the derailleur back out of the way and lift the wheel up and out, don't be shy about it either - you're running the show here.
Unhook the bead With the wheel off the bike, insert one tyre lever under the edge of the tyre and lever it off the rim. Now hold this lever or hook it to a spoke while you insert the second tyre lever about 6-10cm away on the same side. Lever up the bead, then run the second lever around the rim, lifting off the tyre completely on ONE side only.
Get your tube out Remove the valve cap and any other threaded things you find on your valve stem, (you may have none) then remove the tube. Unless the source of the puncture is obvious, such as a tack pin stuck in the tyre, pump some air into the tube. Run the tube past your ear, listening for escaping air. Can’t hear anything? Wet your lips and feed the tube past them to feel for escaping air. You may also find that when you go to pump your tube up it won't inflate at all, this indicates you've got a fairly good puncture and it should be visible.
Tread carefully If you've found a leak, line the valve stem back up with the valve hole in the rim. Unless you flipped the inner tube horizontally, the hole in the tube – which you’ve just found – will line up with whatever caused it. Run your fingers carefully around the inside of the tyre to see if the sharp object is still there. If so, remove it – a knife helps. If you don’t find anything, feel around the rest of the tyre just in case. if your tyre is looking a bit "used" it might not be doing it's job properly, causing you to get flats that are avoidable.
Fit new tube Pack away the punctured tube for fixing at home. Pump a little air into the new tube, enough to give it some shape. Fit the valve through the valve hole, then feed the rest of the tube into the tyre. You CAN patch a tube and refit it on the go however more often then not you'll end up with a flat in the next 10 mins. It is recommended always to carry a new tube and repair the other at home.
Refit tyre Starting opposite the valve, to make fitting easier, tuck the tyre bead back into the rim with the thumbs of both hands. Work both hands around the tyre, in opposite directions, tucking in the tyre bead as you go. You’ll fit most of the tyre like this. If the tyre keeps springing out of the rim – some puncture resistant tyres will try their best to escape the rim seat - don't panic and be patient, two hands is enough to fit any tyre.
Almost there As you get near to the valve, opposite from where you started, the tyre may become tight. It’s tempting to reach for tyre levers at this point. RESIST THE URGE. You run the risk of pinching the tube and puncturing it. First let the air out of the tube so it won’t resist you. Then work around the already fitted section of tyre, squeezing it's sides into the centre of the rim. The centre of the rim is actually smaller than where the inflated tyre will sit, so getting it in there makes it easier to fit. Eventually you’ll be able to lever it on with your thumbs. If not, flip the wheel to face away from you and roll the tyre towards you using one or both hands.
Check your progress Check that the tube isn’t trapped under the bead at the valve by pressing the valve up into the valve hole. Pump up the tyre a little to give it some shape. Spin the wheel to ensure the tyre is mounted evenly on the rim. If not, you’ll need to push and pull the tyre side to side until it fits neatly. Then inflate the tyre until it’s firm. Refit valve cap etc. As you pump the tyre, check for bulges or flat spots, if there is a bulge, let the air out and roll the tyre around on the rim with your hands, sometimes this take a few goes to get right.
Slap it in Front wheel: Make sure the quick release lever is open. Place the wheel back in the bike. Push down on the wheel to ensure it’s sitting snug in the frame. Tighten the round nut on the other end of the quick release enough that the lever starts to snug tight when it’s about half way closed. Closing it fully should require firm pressure. TIP: if you use the flat of you palm to close the quick release it should leave a mark on your palm for a few seconds. Rear wheel:Pull the derailleur back, align the smallest sprocket with the ‘top’ side of your chain (i.e. nearest the ground, when the bike is upside down), and put the wheel into the frame. Push the wheel firmly into the dropouts, then do up the quick release securely. Singlespeed or hub-gear rear wheel: Put the wheel into the dropouts, pushing it forward so you can refit the chain. Pull it back in the dropouts to tension the chain, check wheel alignment, then tighten the wheel nuts. Reconnect the gear cable, if any.
Take a BRAKE Finally, ensure your brakes are reconnected. To test them give the levers a few squeezes, take a quick look at your bike. Does it look good? Yeah it does...