A public blockchain can only exist by many node computers running the same software, which collectively maintains the record of the past of the network. If either the collective record or the software that maintains it become contentious, then there can be a fork in the network. There are three main types of forks:
The most common way in which a fork occurs is when two separate groups of nodes reach consensus on the history of the blockchain. This can happen during when there’s a high transaction volume, and nodes find multiple new blocks which can be confirmed within the rules of the system. In Proof of Work models, the longest chain will always win, so the network will ultimately return to a global consensus quite quickly.
If a change is proposed to the network software, then all of the nodes must update their respective copies and begin running the new version. If some nodes do not update their version of the software, they will effectively no longer be participating in the same network as those who did update. In the event that this happens with a large split in the network, then there will now be one network running different versions of the same software. In these cases, miners using the old software will slowly cease to earn rewards as their version of network consensus is slowly obfuscated.
In some cases, such as the Ethereum DAO hack in 2016, it is not possible for the network to continue with the current blockchain or consensus rules. In the event of such a change, some nodes may prefer not to adopt the new model, and will thereby have an entirely different version of the blockchain and different rules will be used going forwards. Hard forks will always lead to the development of a new chain, and will result in the network being briefly more vulnerable to 51% attacks as there will be less nodes maintaining the security of the network. Ethereum Classic is one such example, it maintains a record of the previous version of the system, along with much lower hashing power than the primary Ethereum chain.