Yeah, spawning is a bit strange in siege mode. In Khirin castle, I've noticed that the first spawn in new rounds is for the attackers like in battle mode (they all spawn around spawnpoint 31), and only once they are killed, one of the other spawnpoints is selected. This is not the same for defenders, though.
Also, I've noticed that in the native maps, spawnpoints are mixed, e.g. in Brunwud castle, 51 is inside the castle. So I think what the other guy wrote about the distance and calculation according to danger could well be correct, except, I think, for spawns 0 and 31, which probably signify the "defender camp" and "attacker camp". After all, how should the script be able to determine where the defender or attacker base is, if not using some entry points?