In general, any update to a coin’s software (at least for those that are democratically controlled like Bitcoin) requires some form of consensus.
Creating a fork that updates the existing software that everyone is currently using requires majority support (consensus) from coin holders (more technically “nodes”) connected to the coin’s network. Those nodes have to agree to the update and then update their software accordingly. This consensus can in-practice come first and foremost from miners and mining pools rather than a general population of users because they tend to control many nodes.
With the above noted, forks only really require consensus in terms of an update being adopted. In terms of just creating a hard fork or soft fork (not adopting it), anyone can copy and paste a coin’s code and change it, and thus create a hard fork or soft fork to potentially be adopted.
In other words, any developer with the necessary skills could decide to fork Bitcoin or create a unique copy of Bitcoin (hence all the actual and potential Bitcoin forks). That is the “easy,” part. The hard part is getting support from miners, users (who have to not only download and configure a wallet but use and trade the coin), and exchanges.
Without support from miners and users, there is no functioning blockchain (hence the term “User Activated Fork”.
Without support from exchanges, there is likely little to no value for the new token.
Thus, a single cryptocurrency with a single blockchain (like Bitcoin) experiences a proper “hard fork” (like Bitcoin Cash or Bitcoin Gold) when the code is 1. changed to create a new coin, but also 2. embraced by enough miners, users, and exchanges for there to be a viable, functioning, alternative.
A fork such as this can occur for any reason, either to innovate (as is the case with Bitcoin Cash), to repair the damage done by a hack (as is the case with Ether), or simply because consensus could not be built for a soft fork (as was a bit the case with Bitcoin Cash and was almost the case with SegWit2x).
TIP: When the majority votes on a change (like the soft fork SegWit), but a minority opposes the majority vote… they may create a hard fork (like Bitcoin Cash).
Can anyone fork a coin? Anyone can go to GitHub, grab the code of a coin (for example Bitcoin), and then do the development work needed to update the software. However, not anyone can get enough miners to mine the new coin, enough users to update their software or download wallets for the coin, and/or enough exchanges to list it. Then, even if they can, getting anything close to the same valuation as the original coin is an uphill battle. So “yes, anyone can fork a coin in-theory… but there are a lot of barriers in-practice.” There have been very few successful forked coins in the history of cryptocurrency. In practice, forks of all sorts require some form of consensus building to be effective. Even ones that are effective tend to have a lower valuation than the original coin. One of the only exceptions I can think of is Ether vs. Ethereum classic (where Ether, the hard fork, has a higher valuation and more users/miners).
FACT: Not every fork will result in owners of a cryptocurrency getting “free coins,” however when a legit hard fork occurs that creates a new cryptocurrency, this is the case. For example, Bitcoin holders received one “free” BCH (Bitcoin Cash) for each BTC (Bitcoin) they owned. That is obviously an absurdly good deal (although one risks the original asset’s price dropping in “split” events like this). Technically one can create a new version of a coin and choose another distribution method, for example, they can do an airdrop or sell the new coin on the open market.
TIP: There are other types of forks as well (forks in general, soft forks as noted above, git forks, [insert Bubba Gump reference]). Any divergence in the blockchain is a fork; the qualifying terms describe the details of the divergence regarding both code and the intent behind the fork.