As I understand it, the longest chain is accepted by all nodes and all others are rejected. This is done to prevent double-spending.
Thought experiment (1):
Some region / country sets up a huge Internet firewall, isolating their bitcoin community. Now you get a fork situation, where that region and the rest of the world are separated. Their miners should still keep working. Say, after a month, the firewall is switched off and the bitcoin communities are reunited again.
Now, as the bitcoin protocol averages one block per 10 minutes, auto-adjusting the difficulty and such. In theory, there could be as exactly as many blocks on either side. When I run my bitcoin client I never see more than 8 connections. If an entire region / country forks off, there could easily be hundreds of hosts in that fork. So...how does the protocol 'decide' what fork to use? Or is it just luck?
At the moment hashrate is increasing all the time and we have an average of 8 minutes a block.
Currently, bitcoins are still being generated. But in a few decades this will stop and we'll only mine transaction costs. Is it technically possible to switch to not-mining at some point, whereby the chain is still protected? Is that even feasible? Now, currently probably not, but if bitcoin were to become mainstream? Surely some form of protocol can exist that prevents double-spending without proof-of-work and still being fully decentralized...
(Maybe in the future people will come up with a solution that doesn't require mining though.)