Well, in the specific case of my example, what was happening was that the player was joining the CTF game as a specific team. The player would get the team he was supposed to have and spawn at a team spawn point. However, for some reason, the server was not assigning the player a team before spawning the player, and would spawn the player at a Deathmatch start instead.
We fixed that glitch by adding the spectator mode as a workaround, making it simply impossible for a player to join the game on a specific team, eliminating the circumstances that caused the bug in the first place.
In that case, the problem was caused by a bug in the game, but it can also happen from having packets dropped from a bad connection or a version inconsistency.