Two producers can find valid blocks at nearly the same moment. The network temporarily holds both, then converges on whichever branch grows first, and the losing branch's transactions return to the mempool.
This is why exchanges require multiple confirmations before crediting a deposit. One confirmation on a chain with frequent one-block reorgs means very little; on a chain with fast finality it can be enough.
Example: an exchange that credits after one confirmation can be attacked by a party with enough hash-rate to reliably produce a two-block branch. Requiring six confirmations makes that attack exponentially more expensive, at the cost of an hour of waiting.
Related: confirmation, finality, mempool, double-spend