Image copyright Getty Images

While a few of the pollsters got the referendum result almost spot-on, others meant that studying the polls failed to give a clear indication of what the outcome would be on the morning of 24 June.

Many people believed that there would be a late shift to Remain in the final days. And the very final polls to be published gave credence to that view. Clearly, they gave a misleading picture.

Looking at the last polls published by each of the main pollsters, the majority of them over-estimated support for Remain, by varying amounts.

Final polls before 23 June vote Pollster Dates Method Leave (%) Remain (%) Over-estimate of Remain support (%) Populus 21-22 June Internet 45 55 +7 Ipsos MORI 21-22 June Phone 48 52 +4 Opinium 20-22 June Internet 51 49 +1 YouGov* 20-22 June Internet 49 51 +3 ComRes 17-22 June Phone 47 53 +5 TNS 16-22 June Internet 51 49 +1 Survation 20 June Phone 49 51 +3 ORB 14-19 June Phone 46 54 +6 ICM 10-13 June Both 53 47 -1

*Excludes the on-the-day YouGov poll published after voting closed, which put Leave on 48%, Remain on 52%.

However, that wasn't the picture throughout the campaign. As we reported on the BBC referendum poll tracker, the polls suggested that the result was in the balance right up to the end.

Phone v internet - an answer

A persistent feature of the referendum polls was that there was a significant gap between those conducted by phone and those conducted by internet.

There was also a lot of discussion about which type of poll was more accurate.

Various theories were put forward: that internet polls failed to capture the views of people with socially liberal attitudes; that phone polls contacted too many people with degrees; or that it was because online polls make it easier for people to say 'don't know' when they're asked how they'll vote.

A widely-discussed paper by Matt Singh of Number Cruncher Politics and James Kanagasooriam of Populus argued that the phone polls were probably closer to the truth because their samples were more representative of the population as a whole in terms of their social attitudes.

The veteran analyst Peter Kellner also publicly stated his view that, based on the polls, he thought Remain would win - although he added the caveat that "if the phone polls have been systematically overstating support for Remain throughout the campaign, then a victory for Brexit is perfectly possible."

With hindsight it looks as though the internet polls were broadly right - with some notable exceptions, including the final Populus poll.

Throughout almost the whole campaign they put the two sides neck and neck, frequently with small leads for Leave, whereas phone polls tended to put Remain ahead, sometimes by quite wide margins.

On the final polls TNS and Opinium were within 1% of the actual result - easily within the margin of error.

ICM online polls Date Leave (%) Remain (%) 10-13 June 53 47 3-5 June 53 47 27-30 May 52 48 20-22 May 50 50 13-15 Ma 52 48 6-8 May 51 49 22-24 April 51 49 15-17 April 50 50 8-10 April 52 48

ICM's record of polls close to the actual outcome stretches back for many weeks.

Interestingly, their last poll was published ten days before the referendum.

YouGov's online polls, taken as a set, were good as well.

YouGov online polls Date Leave (%) Remain (%) 20-22 June 49 51 17-19 June 51 49 16-17 June 49 51 15-16 June 51 49 12-13 June 54 46 9-10 June 51 49 5-6 June 49 51 1-3 June 52 48 30-31 May 50 50 23-24 May 50 50

This isn't to say that online polls are better than phone polls in all cases and for all elections. But for this referendum they were more accurate.

After the result, Andrew Hawkins of ComRes published an interesting statement which set out some of the possible issues that had made accurate polling especially difficult at the referendum.

Regional differences and a large proportion of voters switching between the two sides created unique challenges.

He suggests that it has become harder than ever to forecast national vote shares.

What issues influenced the outcome?

Throughout the campaign, and in post-referendum polls, people were also asked about the issues that affected their decision.

Two issues stood out again and again as being critical: the economy and immigration.

A third issue which was also highlighted, under various different descriptions, was sovereignty - or the ability of the United Kingdom to decide its own laws.

Ipsos MORI found that as 23 June approached, immigration overtook the economy as the most-commonly cited issue that would help people decide how to vote. That could be part of the explanation for the result.

They also found that only 17% believed the Remain campaign's claim that leaving the EU would make households £4,300 per year worse off.

That compared to 45% who believed the Leave claim that Turkey would be fast-tracked into the EU, if we stayed in, with their population given the right of free movement to the UK.

ComRes's post-referendum poll revealed a striking difference between Leave and Remain voters about the relative importance of each issue.

For Remain voters the economy was by far the most significant issue. But for Leave voters it was sovereignty and immigration.

Q: When casting your vote, what was the most important issue in your decision? The impact on…