Just some quick comments on the Pyro to add to the... haha, fire
I've spent several games playing him on various maps on O and D, trying to get a niche for him that I wouldn't be more comfortable just playing a Soldier, Demo, or Heavy
After a bit of work, I managed to top some scoreboards with him, and felt like I was actually contributing to my team's victory.
As already mentioned, he's the best anti-spy defense you can have, and if you are playing D, you frequently have the benefit of waiting around corners, in narrow hallways, and other terrain that favors the flamethrower
Second, you MUST use his shotgun as a finisher. The easiest way to kill someone is light them on fire, back up, and shotgun them to death. People panic while on fire, and even those that stay cool (haha), the Pyro moves very quickly, so only a few classes can stay near him. Staying at point blank with the Soldier, Demo, Heavy is suicide, dangerous against the Scout, and even 'weak' close range classes can still deal a lot of damage
Plus, using the 'stick and move' maxim, you tend to stay alive longer, and set more people on fire. Sometimes you don't score kills, and it's rough to have your contribution feel nebulous, but reducing multiple players to low health IS helping your team, even if it isn't quite as visible as mowing down half their offense as a Medic backed Heavy. Don't be afraid to just graze people with the flames and back off - you've done plenty of damage with just a second of close range, dangerous combat.
Speaking of the Medic, next to the Heavy, the Pyro is my favorite target for invuln, unlike a Soldier or Demo, he can fire his flamethrower until out of ammo, so you can absolutely go on a torching rampage with him
What else... be aware of the extra ammo locations, or ask (via voice, people listen more) for an Engineer to get up a Dispenser in a specific useful location.
Similarly, if you can get an Engineer to set up a teleport exit at a position that gets you close to the enemies defensive line, you can avoid the march across open ground - the worst possible terrain for a Pyro to be on
And on the topic of open ground, avoid it if at all possible. If you have to cross it to reach an objective, move through it quickly, using any available cover. Don't get distracted by enemies that aren't relevant to your objective, and DON'T try to chase people with your flamethrower. Take potshots from a distance with the Shotgun, it deals decent damage even at medium range.
In combat, abuse your flamethrowers lack of a reload. Against classes that have to reload, use your maneuverability to pepper them from a distance with shotgun fire while dodging rockets/grenades/etc, then close in when they have to reload with your flamethrower.
The Pyro BLOWS against turrets, avoid them, notify your team of their location, and move on to other goals. In a situation where your team is retarded and the enemy has a lot of good Engineers, you may not have a choice but to switch to another class, but that happens plenty no matter what class you're playing.
I still think it's goofy that he's labelled as an offensive class, but his anti-spy defense is one of the best in the game, and I also think it's weird that his secondary weapon is just as important as his primary for actually scoring kills, but he can be effective.