There's plenty to do while waiting in spawn. Here's what I generally try to do:
1. (Attempt to) Communicate with teammates
Say Hi. Ask how their day is going. Establish a rapport, then (in conjunction with point #4) work out some game plan with them (Heavy+Med to exit right door, Bonk scout to distract sentry, and so on).
This won't always work of course - some people just don't communicate, or aren't interested. That's the nature of pubs. But you won't know unless you try.
2. Keep an eye on your team's class composition
Look around at your teammates spawning in, and occasionally check the 'class change' screen. Do you notice a distinct lack of Power classes? Is your team lacking a Medic? Are there 5 Snipers? Consider switching to what your team is lacking, and ask others to do the same* (easier to do if you've established a rapport, see #1).
Also have a look at your loadouts, and ensure that they're what you want to use for the upcoming match.
* It's easier to convince others to switch if you give them a reason to do so: "Hey, if one of the Snipers wants to go Heavy, I'll Uber you out the left door and we can smash up their Sentry Nest." is a lot more appealing than "OMG can we not have 5 Snipers?"
3. (Medic) Build Overheal and Ubercharge
Thanks! You've picked Medic! You know what to do. Build up your teammate's Overheal as well as your own Ubercharge. Then - just like the peacock - find a mate with the flashiest hats* and Uber him out the gate.
* Not always a guarantee that this person is a good player.
In all seriousness, I'm assuming you know the basics of how to play Medic. If not, start here.
4. Peek out the gate at the other team
Check the other team's composition:
- Do they have 3 Engies setting up a nest on the right side?
- Are 4 Snipers scoped in on the middle door?
- Are Demomen laying sticky traps at the gates/choke/cart/point?
- Are Pyros getting into position to roast people as they leave spawn?
- Is one or more of your teammates wandering around outside with the enemy team? (If so, Press X+2)
Use this info in conjunction with #1 to formulate game plans with your team.
5. Help your Engie level up buildings
On some maps, it's possible to build inside the spawn area. If an Engineer is trying to get a Dispenser or Sentry to Level 3, switch over to Engie and whack his buildings a couple of times. Having a Level 3 dispenser to fall back to will be mighty helpful for everyone. Teleporters are probably less important before-round, but if you have nothing better to do, why not?
6. (Heavy) Ready a deployed Sandvich
As the countdown gets closer, a Heavy can alt-fire a Sandvich (or Banana etc) to throw down a temporary health pack near the spawn exit, then instantly fill the recharge meter by touching a resupply cabinet. The deployed 'health pack' could provide a welcome source of health for someone retreating back in, including yourself or your medic.
7. Have Fun!
Participate in (or start) a conga (maybe convince players (on both teams) to go for the Conga Line Taunt achievement). Play Rock Paper Scissors or give out high-fives. Show off your taunts. Leave animated gifs and memes on the walls. Adjust your cosmetics. Taunt at the other team.
TF2 is one of the only games I know where it's both possible and encouraged to just...chill out and enjoy a moment