A chain reorganization happens because nodes on a blockchain never blindly trust the first block they see; they continuously compare all valid chains and follow the one with the most accumulated work (proof-of-work networks) or the greatest validator weight (proof-of-stake networks). When a heavier competing branch appears, every node discards the blocks unique to the old branch and adopts the new one, and any transactions that were only in those orphaned blocks return to the mempool to be re-included later.
Shallow reorgs, usually just one block, are a routine byproduct of network latency: two miners or validators produce a valid block at nearly the same height, and the tie resolves itself within a block or two as one branch pulls ahead. Deep reorgs are a different matter. They require sustained control of a majority of a network's mining or staking power, letting an attacker secretly build a longer private chain, release it, and erase already-confirmed transactions, opening the door to double spending.
The clearest recent non-malicious example was Ethereum's Beacon Chain reorganizing seven blocks in May 2022 after a fork-choice bug split validator software versions; no funds were lost and no finalized blocks were touched. Bitcoin, by contrast, has never suffered a deep reorg, since rewriting even a few hours of history would require an amount of hash power that costs far more than any plausible profit.
Exchanges and payment processors manage this risk by waiting for multiple confirmations, and networks with fast finality guarantees reduce reorg risk further by making certain blocks provably irreversible once checkpointed.