Hi there,
I think the logic is that the connectionToClient you are passing into the Spawn() method, is the connection to the client which owns the UnitSpawner. So since only one client has authority over that specific UnitSpawner, the connection to that client is passed into spawn here and assigned to the unit. Mirror knows which client has authority of that instance of the UnitSpawner.
To summarize, the UnitSpawner is a netowrkBehaviour with an assigned owner, which mirror knows about. The server has a connection to that owner called the connectionToClient. The server passes that connectionToClient into spawn and assigns it to the new unit.
Hope that helps, if it’s not clear, let me know and I will try to reiterate.