How is a blockchain split resolved?
You're looking for CBlockIndexWorkComparator, which operates by three rules. The rules are applied one at a time, and if a rule leads to a tie, then the next rule is applied.


Which blockchain has the most work? 
Which one was received first? (This can be different for different clients, which is why the previous rule is applied first.)
Which one has a larger pointer address? (This is largely random, and different for different clients.)