What happens if two miners create identical blocks at the same time and half of the network accept the block from the first miner and other half from the second one? Which miner will be rewarded?
Due to the contents of the block headers, it is quite near impossible for two miners to generate blocks containing different transactions but have the same block hash. Unless of course, there is a collision. I'm assuming you're talking about blocks at the same height.
Taking Block A and Block B as the block that gets generated at approximately the same time and nodes will see either of the blocks. Once the miner receives either of the block, they would start working on it. Miners will start building a block by referencing Block A or Block B, mostly depending on the block which it sees first. Once a miner that was mining ontop of Block A finds a Block (calling it Block C), the half of the network that didn't see Block A first would simply just request data of Block A and accept both Block A and Block C while discarding Block B and those that accepted Block A first would just simply verify and accept Block C.
Since the chain containing Block A has a larger proof of work, this means that the network follows the chain for which Block A and Block C is in but discards Block B. As a result, Block B doesn't get rewarded as it is not included in the longest chain and thus the Coinbase transaction that I have mentioned won't exist.