The very first task is to put on disposable gloves, if you have them. Gloves protect your hands from cuts, abrasions, dirt, and grease.
The second task is to look around the tire for an object that may have punctured the tire. If you find the culprit, pull it out of the tire.
If you know where the puncture is on the tire, and you have your patch kit with you, you can leave the wheel mounted on the bike. Just pry out a section of tire bead, and pull out enough of the inner tube to find the puncture, as shown below. Patch it, put the tube back in place, and pump up the tire. For details, see other sections of this website which discuss how to do those things.
Otherwise, you'll have to remove your wheel.
In both cases, at some point you'll need to either lay the bike on its left side (chain and derailleurs off the ground) or set it upside down (resting on the handlebar and seat). Do not rest the bike upside down if doing so puts weight on anything breakable that's attached to the handlebar, such as accessories or the points where brake cables enter brake levers.
Take a look at the brake pads. Are they so close to the wheel that they'll block the tire from being pulled away from the bike? If so, look for a point where the brake cable can be detached from the brake or for an adjustment that widens the brake enough to let the tire slip out. Alternatively, just squeeze the tire so it's thin enough to get past the brake; later, avoid pumping the tire until after you've reinstalled the wheel on the bike, because it's too difficult to squeeze an inflated tire.
To remove the front wheel, you probably just need to flip a quick-releasing lever. It's located at one outer end of the wheel's axle. The photo below is actually of a rear wheel, but the release is identical for the front. If you see a nut instead of that lever, you need a wrench to undo that nut and release the wheel.
Typically you just have to pull the lever out away from the bike, so it ends up looking like the above image. It may require quite a bit of force to first move it, but it quickly gets easy.
Sometimes the wheel is not made loose enough by doing that. You can hold on to one end of the axle, as shown in the photo, then grab and twist the opposite end. Or hold that opposite end still, and use that lever to twist it loose.
If your bike has a rear derailleur, you might find it helpful to shift to its highest gear. This will cause the chain to move so it wraps around the smallest of the pointy round cogs on your rear wheel. That could make removing and replacing the rear wheel easier.
Since you have a flat rear tire, you shouldn't ride the bike. But pedaling is needed to shift gears on many bikes. There are several ways to handle this:
Some bicycles have a short peg, as seen in the center of the photo below.
Lift the chain up onto the peg. This will make removing the wheel easier.
If you see a nut instead of the lever shown below, you need a wrench to undo that nut and release the wheel.
Otherwise, flip the wheel's quick-releasing lever. Typically you just have to pull the lever out away from the bike, so it ends up looking like the image below. It may require quite a bit of force to first move it, but it quickly gets easy.
Sometimes the wheel is not made loose enough by doing that. You can hold on to one end of the axle, then grab and twist the opposite end. Or hold that opposite end still, and use that lever to twist it loose.
By lifting the bike's rear, you should be able to push down on the wheel and force it to drop out from the frame. In the photos below, the chain appears to have fallen off that peg I mentioned earlier.
You can push the chain out of the way, if needed. Pull the wheel clear of the bike and set it aside, then set down the bike.
This is what you do after you finish fixing the wheel.
To put a wheel back on, undo each step of the removing process, starting with the most recent (last) step.
In other words, set the wheel into the bike exactly how it was before removal. Be sure that the axles slide all the way into the dropouts that receive them.
If the wheel attaches with nuts, hand tighten them and then gently use a wrench to tighten further.
If the wheel attaches with a quick-release, hold onto the lever and twist the other end until it just starts to resist you. Try flipping the quick-release lever toward the bike; you could actually flip two ways, so choose the way that gets more difficult as you flip. Stop forcing that lever when the pressure leaves an impression in your skin that lasts a little while.
At this point, the lever should be about parallel with the wheel, and the wheel should be securely attached to the bike. If that didn't happen, flip the lever loose, try twisting it a little, and then flip it tight again; keep trying this until you get it right.
If you released the brake to remove the wheel, undo that to reengage the brake.
Lift the bike slightly off the ground and spin the wheel. Does it wobble side-to-side or rub against a brake pad? If so, loosen the wheel, slightly shift where the wheel clamps to the bike's dropouts, and retighten. Keep trying until it spins evenly and freely.