Hardfork
A hard fork is a protocol change that is not forward compatible. Blocks created according to the new rules are invalid under the old rules. To prevent a split of the chain (fork), all nodes must update their software.
There are two possibilities. The new rules are incompatible with the old rules or they are less strict (like increasing the maximum block size from 1 MB to 2 MB).
Let us assume that the majority of miners updated their software. The protocol change happened after block B.
The first block appended to the chain is block C (blue). it follows the new rules. In our case, it is block C.
If now a miner who is still following the old rules creates a block C’ (yellow). It cannot add it to Block C because this is an invalid block from the miner’s perspective. Instead, it has to build upon block B.
Now, the updated miners have the choice. They can either build upon block C or block C’. This is possible if the new rules are less strict than the old ones. If they are incompatible, the updated miners can only build upon block C. But even if the rules are backward compatible, the next miner likely chooses block C over C’ because it should have heard of it earlier.
Let us assume that the next two miners follow the new rules. This is reasonable because we said that the majority of miners have updated their software.
If we continue with this, we see that this chain has split into two branches. While one branch follows the old rules, the other one follows the new ones. Both branches can’t be merged back into one chain.