Brexit explainer: What's in the deal, and what happens now?

We are 1,211 days on from the British referendum in 2016 where it was decided the UK would leave the European Union.
Two Prime Ministers and two deals later, it appeared only a few days ago that we were heading for a disastrous crash-out Brexit at the end of this month.