I write this assuming that you know the basics of pyro, which includes things like no backburning or raking or whatever the fuck, and you know how to quickswitch to flare guns for easy finishers, ambush spots, putting people out and things like that. If you don't know these things, you should probably not be participating in a HL league.
The role of pyro is very varied, you may have different roles depending on the map type, whether you're holding or pushing, what point number number you're on, and how much trouble your team is having with the enemy spy, and how shitty your combo/engineer are at spychecking. You have three main concerns, which boil down to:
-Reflecting (spam and ubers)
At any point in time, one of these is the most important. Your job is to switch between the three. Consider which kind of play is best for which situations.
For example, you have just captured mid on a 5cp map. The opposing medic is running uber, the enemy spy is not very good, and your engineer is running big sentries in case you get pushed back. What do you do? You roam far from the medic and kill stuff. In this case, reflecting uber doesn't matter, since your team has the advantage and is pressing it instead of holding. Since you are on attack, staying with your engie is pointless as well, his gun is not important. What if the spy were good and getting lots of combo picks? Float close to the medic, his life is more important than yours. If you were holding instead of attacking? Get ready to reflect an uber. What if you're defending last point? Stay with the gun.
For example, you are defending first point on Badwater. Your engineer sets up on the top right-hand side. Your combo is there too. This is the usual setup for Badwater first point. In this case, you stay with the engineer and reflect spam from the soldier on the far left that is the only main line-of-sight from the sentry. You spycheck the only way a spy could get up, which is the ramp - a difficult approach. When the uber comes up the right hand passageway, you reflect them down the ground. If they come with a demoman, it will be an easy job for reflecting. With a heavy, your medic should pop an uber on you while you are reflecting. In this case, Uber reflection > Sentry gun protection > Killing stuff by a long shot. Consider running a homewrecker as well.
Don't forget that you are a damage class though. Keep in mind that the only class worth protecting from spies all the time is the medic. Protect the engineer on defense/last point of 5cp only. If the sniper or anyone else complains tell them to put on a razorback and stop wasting your time. If you're ever unsure of your position, default to kill everything.