Generally, the only way you'll get killed by a Scout from behind. The Scout's primary advantage is his speed. To take advantage of this, a scout will do his best to get behind you while pumping you full of nails.
Usually, they'll just try to sail on past you, as they are ill equipped for a firefight, and the more damage you do to them, the less likely it is that they'll cap the flag. Watch out for concussion ("conc") grenades; they don't do damage, but they can put you out of action for a while (Friendly Medics can heal the effects of the concussion grenade with a single swing of the axe). If you have been hit with a conc, don't fire. You might get lucky, but for the most part, the only damage you're going to do is to yourself.
Prime scout burning areas are tight hallways where it can be nigh impossible to avoid your flamethrower as they pass. Of course any damage you can do to a scout is worth-while, so don't pass up a shot with the incendiary cannon at long range, it might just be the thing to stop him from capping.
Summary: Keep your eye on him, don't let him get behind you, and flame away.
Caelyn says, "Snipers are goooood eatin'! They like you to think that they're the most dangerous thing on two feet, but the truth is that snipers are a bunch of whiney little girls (no offense, ladies)."
Snipers are very dangerous in that they can kill you with a single shot. This is a class that requires a low ping and good reflexes. The key to your survival is knowing where they are (or are likely to be). When traveling through sniper infested area, try to move erratically; vary your speed and direction, to keep them from getting a clean shot off.
They like to hide in dark areas, with a good field of view. Be sure to light up those dark areas for them with a nice shot from the incendiary cannon. As a bonus, you'll get to watch those snipers do their Michael Jackson impression, as they moonwalk with their hair on fire.
When focusing on a target, snipers can be highly vulnerable from the sides and rear. Often, snipers will ignore the fact they're being attacked or that a grenade has just landed at their feet.
Snipers have light armor and health, and run at a decent speed. In addition to their rifle, they can also whip out a shotgun or switch to rapid fire.
Summary: Always be aware of good sniping locations. When in doubt, use your incendiary cannon to light up a dark spot. Try to get behind a sniper, while their attention is elsewhere.
The nemesis of the Pyro. The soldier is the only class to be truly feared. They've got more armor than you do. They do more damage with a rocket hit than you do, and their rockets travel faster. You cannot survive a slugging match with one of these guys.
One of the soldier's biggest weaknesses is that he must reload every fourth shot. This gives you a few seconds to attack without fearing damage from his primary weapon. Don't forget to watch for grenades, though, since most soldiers are very good with them.
The soldier is the standard class in Team Fortress. Most people play it, or have played it at some time. If a soldier has been around for a while, they will have a lot of training in combat in open environments (Take a look at the map sq1, or its variants, to see what I mean). Try to use the terrain against them.
Your best bet for taking out a soldier is your Regular Grenades. Flame will do a lot of damage, but it won't be enough to finish him off before your parts are splattered about the room. Remember, this is a team sport, though, so any damage you can do to these guys makes it easier for your teammates later on.
In MegaTF, soldiers have a couple extra toys to play with. First, is the spike trap. These don't do much damage, but they slow you waaaay down. You might as well be playing as an HWGuy at that point. Second, the dreaded Proximity Mine. They can plant these things just about anywhere, and they detonate as an enemy approaches. Prime spots for either of these are dark areas, chokepoints and right as you turn a corner. Boom!
Summary: Flame and go! Odds are not in your favor when taking on a soldier. Use your grenades, the terrain, and your faster running speed to your advantage.
Demolitions Man -
For the most part, the Pyro and the Demolitions Man (DemoMan) are on pretty even footing. You have comparable speed, health and armor. A good DemoMan, though, can do a HELL of a lot more damage than you can.
The DemoMan's primary weapon is his pipe bomb (in one of two variants). The pipes don't detonate on impact like a rocket, so be prepared for them to go bouncing off walls. "Red" pipes detonate after a set period of time, while the "yellow" pipes are controlled by the thrower. A good DemoMan will be able to pitch a yellow pipe right at your forehead and detonate it an inch away from your skull... Not very pleasant, let me tell you!
Watch out for yellow pipes on the ground. If you spot them, try to find an alternate route or trick the DemoMan into triggering them too soon.
Summary: Between "red" and "yellow" pipes, Regular Grenades, MIRVs, and DetPacks getting too close to a DemoMan can be like walking through hell. Try to keep your distance, and get him to make a mistake. Be careful what you're standing on!
Combat Medic -
The Combat Medic is probably the highest cause of suicide amongst quake players (in game). The Medic rarely kills right away; their attack causes you to slowly degenerate until you reach 0. Often, players prefer to sit on their own grenades or charge into enemy fire rather than giving the Medic the satisfaction of a frag.
Medics can whip out a Super Nailgun if the mood strikes them, but their primary weapon is the Bioweapon (axe). One hit from an enemy Medic's axe, and you'll be in agony. A friendly medic can cure you, a steady supply of medpacks can sustain you, but otherwise, you're screwed...
Medics are fast, but they don't do a lot of damage outright. If you can keep away from their axe, you should be pretty safe. Medics tend to be more aggressive than scouts, so don't be at all surprised to find one of these guys circle-strafing you, turning you into a pincushion. Its embarrassing as all hell to be killed by a Medic (not as bad as death by scout, though), but it happens.
Medics are very fast. And while they are lightly armored, they can heal themselves automatically. With a scout, if you manage to get a good shot at them, your teammates will surely finish them off... but with a medic, they might be back up to full health by the time they run into anyone else!
In MegaTF, the Medic can drop an infected syringe on the ground. They're hard to spot, and when you run over them, its just like being hit with their axe. So keep your eye on the ground!
Summary: Lightly armored and quick on their feet, watch out for the circle-strafe and keep away from that axe! Try to block their path in tight hallways.
Heavy Weapons Guy -