Basically how are chains kept in sync so that there is only one main chain?
The "real" chain is whichever chain a majority consensus of network participants considers to be real. There isn't exactly a "real" chain; only an "agreed upon" chain.
Bitcoin is an incentive based system, and in the long term, it is in everyone's best interest to use the chain that everyone else is using. Bitcoin clients use a "longest chain" rule to determine which fork of the chain is the one they (individually) consider to be "real". Of course, every block on this chain must abide by the rules which that client deems to be the "real" rules. When different clients disagree on what these rules are, a hard fork occurs.
Miners participate in a process called proof of work which essentially relies on proving the commitment of irretrievable resources to further a blockchain. This real cost is what incentivizes people to come together and build on the same chain. If they were working on different blockchain tips, some of them would be unable to reap the revenue which would curb their ability to continue mining.