I'm trying to wrap my head around how any one of the clients could become a new host should the current host leave the game. I'm not looking for any code, but more of a high level application design of how a feature like this would work.
Leader election is an interesting topic, and there are several solutions available.
One such solution is the "bully algorithm", in which all clients (including the host) have unique IDs, which determine rank/priority to control an election. When a client detects that the host is no longer present, it sends out an inquiry to higher ranked nodes to see if they are active. If it receives no response, it declares itself the leader (host) and notifies all other clients of the change.
You can read more about this method, and a few others, in the Wikipedia article I've linked.