First, let's look at the vote across the UK. The pollsters got one thing, at least, absolutely correct.
For months they have been suggesting that Scotland was the most pro-Remain part of the UK; that Northern Ireland was also pro-Remain, although somewhat less so; and that things looked much closer in both England and Wales, with Wales tending to be marginally more pro-Remain than England.
And that is exactly how it turned out. These are the figures for voting (and turnout) by nation:
Strikingly, the two nations that voted for Remain - Scotland and Northern Ireland - have both actually become more pro-EU since 1975. Wales and England have travelled a long way in the other direction.
It is also interesting that turnout was lower in the two pro-Remain nations.
This didn't change the result - even if both Scotland and Northern Ireland had had the same turnout rate as England, then Leave would still have won.
It may be simply that the referendum engaged more people in England and Wales.
But there may also have been some element of voter fatigue - and also activist fatigue - in Scotland, in particular, which has had a lot of campaigning and voting over the last three years.
What about the vote in Wales? Understanding exactly how Wales came to vote leave will take plenty of further analysis.
But we can see which areas voted for Remain and Leave.
Here I've listed the 22 Welsh local authorities in order of how they voted, from the most pro-Remain to the most pro-Leave:
One notable feature of the results is how many prominent Welsh politicians found themselves on the wrong side of their own local communities.
Among those who supported Remain:
Meanwhile, on the pro-Leave side, Conservative leader Andrew RT Davies also found himself on the opposite side of the majority of his fellow voters in the Vale of Glamorgan, as did MP David Davies in Monmouthshire. But that was not the case for all politicians.
Former Welsh Secretary David Jones - whose Clwyd West seat straddles the border of Conwy and Denbighshire - would have been delighted that a majority in both counties followed his advice in supporting leave, while current Welsh Secretary Alun Cairns was (just) in the pro-Remain majority in the Vale of Glamorgan.
How did the EU referendum produce the result it did?