Spawns, from what I've seen is based on visibility. So for example, if you are unable to see or rotate to see a spawn, then a player can spawn there. This leads to spawncamping, where players can still hit the player without it registering as them seeing the spawn, or just being able to move back and forth behind a wall to spawncamp. An easy fix to this would be making spawns based on vicinity to other players, using some sort of technical ranking system where players will spawn in places with the furthest players, based on the location of ALL of the players in the game.
In simpler terms, the game should rank spawns based on a score that dictates essentially the average distance of players from the spawn, and favor those spawns to players who just died.