How does the bitcoin network recover in case of a hash collision in the block hash? A Bitcoin client has to download the whole blockchain from the P2P network in order to become a full node.

A full node is able to determine, if a transaction in the network is valid or not.

To download the blockchain, the client queries other peers in the network for more blocks by providing them with the hash of the last block it has currently in its downloaded blockchain.

The other nodes search in their currently best blockchain for the specified hash and return a list of hashes of further blocks the client can download.

After the client determines that the further block hashes are indeed in the longest block chain by crossvalidating other nodes, it requests those blocks from its peers by giving them the hashes of those new blocks.

After the download, it checks for itself that the blocks follow the rules of the bitcoin network and inserts them in its current blockchain.



This algorithm assumes that any valid block in the blockchain has a unique hash that identifies it.
What happens, if by chance a block is inserted in the blockchain that has the same hash as a previous block and that complies with all rules of the bitcoin network?

Wouldn't that break the algorithm?
It would not break the algorithm. 

As the inventory vector of the described new block would be a duplicate of an already known block, no other node would request this block. It would just be ignored, as if never discovered in the first place. Everybody else would still be hashing away happily, obsoleting the block eventually.

Tough luck for the miner, he'd not get the reward, because everybody would be convinced that no new block has been found at that height yet.

Of course, chances of that happening are negligible, because the block hash is a random 256 bit output (smaller than the current target), which allows for an immense number of possible hash outputs of a similar magnitude as the address space.

Actually, @NickODell made me aware that it can cause a problem, when nodes see the newer block before the older block that was already part of the longest chain. In that case the node would be unable to synchronize, as it would not be able to build the complete chain.