What determines the spawn wait time in Team Fortress 2?

Solution 1:

There are set times when respawns happen, every 10 seconds by default. So if you spawn just after the timer has reset you will have the maximum wait. Wait times also vary by map and game type, so it can be anything between 5 and 20 seconds.

From the TF2 wiki:

Team Fortress 2 manages its respawn times in waves. The default respawn wave is 10 seconds. This would mean that players are spawned every 10 seconds. However, unless the server population is low, you will most likely have to wait for the wave after. In this case, the maximum respawn time any individual would have is 20 seconds.

Source: TF2 Wiki - Respawn Times page