I'm sure many of the factors you mention are relevant, but I think the main reason is much simpler:
- Scotland voters are very heavily weighted towards being Labour, SNP, or Liberal Democrat voters (i.e. the "left" of the political spectrum) whereas voters in the rest of the country are more likely to be Conservative voters (the "right" of the political spectrum).
- The "left" are more likely to be pro-EU and the "right" are more likely to be anti-EU.
Here is a map (source) of the 2015 general election results showing how stark the contrast is:
- Light yellow = SNP
- Dark yellow = Liberal Democrats
- Red = Labour
- Blue = Conservative
And here is one from the 2010 general election (source) showing a similar contrast:
And finally, the EU referendum results (source). In Scotland the correlation is obvious, but even looking at the rest of the UK, you can see a fair amount of overlap between the few parts of England and Wales that voted remain, and those that voted non-Conservative.
- Yellow = Remain
- Blue = Leave
Here's some more evidence that there was a correlation between what party you voted for in 2015, and how you voted in the EU referendum (source) (in order: Conservatives, Labour, Liberal Democrats, UKIP, Green, SNP):
A majority of those who backed the Conservative in 2015 voted to leave
the EU (58%), as did more than 19 out of 20 UKIP supporters. Nearly
two thirds of Labour and SNP voters (63% and 64%), seven in ten
Liberal Democrats and three quarters of Greens, voted to remain.
The correlation between political party and EU preference is apparent in the parties themselves too. The Conservatives were divided on the EU and provided the loudest voices in the Leave campaign, along with UKIP. Labour, the Liberal Democrats, and the SNP were almost unanimously in favour of Remain.
That leaves the question of why Scottish voters are far less likely to vote Conservative, but I won't address that as it would make the topic too broad.
EDIT in response to this comment:
What about the reversal of the 1975 referendum mentioned in gerrit's
answer? – hkBst 4 hours ago
The situation back then was different. The 1975 referendum was to remain in the EC which had a narrower scope than what is now the EU. Free trade was a more prominent component, whereas now political integration and socialist ideals have become bigger issues. At the time, Labour was more Eurosceptic than the Conservatives:
In the 1970s and early 1980s the Labour Party was the more Eurosceptic
of the two parties, with more anti-European Communities MPs than the
Conservatives. In 1975, Labour held a special conference on British
membership and the party voted 2 to 1 for Britain to leave the