Can somebody explain the dramatic difference in votes between Scotland and Northern Ireland on the one hand and England and Wales on the other?
Darren covered it all really. It's complex.
One other aspect that springs to mind is the surge of the SNP in Scotland. Nicola Sturgeon is an astute politician, and has run an effective campaign in Scotland to gain the votes of the Labour and LibDem supporters. Labour and LibDem have been all but wiped out in Scotland. Commentators suggest that Scottish Labour and LibDems have been abandoned as voters feel they are English-centric and no longer understand the needs of the Scottish population. There only real option is the SNP, and Sturgeon has done a great job capturing these voters. The SNP firmly aligned itself with remain, and with Sturgeon at the wheel the vote went that way.
Another consideration is that TV in the UK is very regional, and the exposure to the campaigns would have been very different.
Further, Scotland has the right to set its own budgets, so arguments south of the border would not have applied to Scotland. The battleground in England was divided over different issues to Scotland. The devolved parliament in Scotland gave a different campaign focus, a focus that resonated with the people more.
Also, it may be that Scottish people are far more progressive and outward looking. The clan system and highland way of life is still embodied in the culture of Scotland.
Northern Ireland showed divisions between Unionist and Republican areas, but I would have to find out a little more to really comment on Northern Ireland. The Irish vote is probably the most bitter pill to swallow, as Ireland is in the EU. Once the UK leaves the EU, control of the border could become an issue and there is potential to open old wounds.