How fork choice rules let blockchain nodes agree on one valid chain when forks appear, and how PoW and PoS pick the winner.