The UK has voted to quit the European Union following a referendum on its membership. So how did the Leave campaign win?

1. Brexit economic warnings backfire

Image copyright EPA

What started off as a trickle soon became a steady stream and ended up as a flood.

The public was bombarded with warnings about how they would be poorer if they voted to leave the EU but, in the end, weren't convinced by what they were told and/or believed it was a price worth paying.

The CBI, the IMF, the OECD, the IFS - an alphabet soup of experts lined up to say economic growth would be hobbled, unemployment would go up, the pound would plummet and British business would be left in a no man's land outside the EU.

The Bank of England raised the prospect of a recession while The Treasury said it would be forced to put income tax up and slash spending on the NHS, schools and defence.

If that wasn't enough, President Obama suggested the UK would go to the "back of the queue" in terms of securing a trade deal with the US while top EU official Donald Tusk hinted at the end of Western political civilization.

Some on the Remain side accepted this was overkill and that so-called "Project Fear" had got a bit out of hand while the Leave campaign was quick to dismiss the naysayers as wealthy, unaccountable elites with their own vested interests talking down Britain.

But the fact the public discounted so readily the advice of experts points to something more than just a revolt against the establishment. It suggested far more people felt left behind and untouched by the economic benefits of five decades of EU involvement being trumpeted.

How will Brexit affect your finances?

2. £350m NHS claim gets traction

Image copyright Getty Images

The assertion that leaving the EU would free up £350m a week extra to spend on the NHS is the kind of political slogan that campaigns dream of: striking, easy to understand and attractive to voters of different ages and political persuasions.

No surprise then that Vote Leave chose to splash it across the side of their battle bus.

The fact that the claim does not stand up to much scrutiny - the figure is calculated using sums which were disputed by the Treasury Select Committee and described as potentially misleading by the UK Statistics Authority - did not reduce its potency.

Remain campaigner Angela Eagle may have told her opponents to "get that lie off your bus" but polling suggests it gained traction and was the single most remembered figure from the campaign, with many people believing that money handed over to the EU to be a member should be spent in the UK instead.

In that sense, it served as a powerful illustration of how the UK could be better off outside the EU.

3. Farage makes immigration the defining issue

Image copyright EPA

If they didn't quite bet the farm on the issue of immigration, Leave played what they knew was their trump card often and they played it successfully.

The issue fed into wider questions of national and cultural identity, which suited Leave's message - particularly to lower income voters.

The result suggested that concerns about levels of migration into the UK over the past 10 years, their impact on society, and what might happen in the next 20 years were more widely felt and ran even deeper than people had suspected.

Just as crucially, it suggested Leave's central argument that the UK cannot control the number of people coming into the country while remaining in the EU really hit home.

Turkey was a key weapon in Leave's armoury and, although claims that the UK would not be able to stop it entering the EU were firmly denied, there was enough uncertainty about this - a fact that the ongoing migrant crisis in Europe unquestionably fed into.

The language and imagery used by the Leave campaign came in for criticism and there were recurring tensions between the Conservative dominated official Leave movement, Nigel Farage's UKIP roadshow and the separate Leave.EU group.

But their various messages resonated and segued with their central proposition that a vote to leave was a once in a generation chance to take control and assert national sovereignty.

4. Public stop listening to PM

Image copyright PA

David Cameron may have won one leadership contest, one (or two if you include the 2010 coalition-forming one) general elections and two referendums in the past ten years but this was the moment his luck ran out.

By putting himself front and centre of the Remain campaign, and framing the decision as a question of trust, he staked his political future and personal reputation on the outcome.

Having put so much store on his ability to secure a fundamental change in the UK's relationship with the EU, it was inevitable that the concessions he came back with following nine months of negotiations would be dismissed as a damp squib by Eurosceptics in his party.

But this summed up a deeper problem. Having constantly stated that he would "not rule anything out" if he didn't get what he wanted, trying to enthuse the UK to stay in on the basis of reforms most believed were modest at best was always going to be a difficult sell.

Throughout the process, he found himself at odds with many Conservatives who have never quite reconciled themselves to his decision to go into coalition after the 2010 election and the compromises that brought.

Unsuited to winning over Labour supporters, the prime minister was not able to persuade enough floating voters to give him the benefit of the doubt.

It was his failure to get the outcome he wanted, coupled with his desire to try and unify the country after the bruising campaign, that prompted him to say he would stand down as PM by October.

5. Labour fail to connect with voters

Image copyright PA

The Remain campaign always needed Labour voters to win the referendum and the fact that they did not play ball will be the subject of a long and acrimonious post-mortem within the opposition.

Not only did Labour - 90% of whose MPs backed staying in the EU - badly misjudge the mood of its supporters, when it realised something was wrong during the campaign, it was unable to do much about it.

Despite sending in big beasts such as Gordon Brown and Sadiq Khan to talk up the benefits of the EU, and hinting that further controls on immigration would be needed, it was unable to shift the impression of a growing schism between those running the party and its base.

Although Alan Johnson, the head of Labour In, has been singled out for criticism, it is likely that Jeremy Corbyn - who declined to share a platform with pro-EU politicians of other parties - will take most of the blame.

Critics have said his lukewarm support for the EU - which he summed up as 7 out of ten in one appearance - filtered through to the entire campaign and his emphasis on the need for a "social Europe" simply did not resonate with enough people.

6. Big beasts - Boris Johnson and Michael Gove

Image copyright PA

We always knew a handful of cabinet ministers would support Brexit but it was Michael Gove and Boris Johnson's declaration of support which really put rocket boosters under the campaign.

The justice secretary brought intellectual heft and strategic nous to the table while the former mayor of London, after a bout of soul-searching, brought star appeal and ability to appeal across the party divide.

The two men were deployed deftly, Boris Johnson cast in the role of foot soldier as he criss-crossed the country on the Vote Leave bus, pulling pints and brandishing cornish pasties in his wake.

Meanwhile, Mr Gove did much of the heavy lifting, helping to put together Leave's post-Brexit manifesto as well as facing the public in TV referendum specials on Sky News and the BBC.

Then there was Nigel Farage, the face of Euroscepticism in the UK but also a potential loose cannon for the Conservative dominated official campaign? The UKIP leader, as is his forte, did his own thing and occasionally provoked controversy but also played a vital role on the ground in motivating his party's supporters and numerous others to go to the polls.

7. Older voters flock to polls

Image copyright PA

While experts will pore over the finer details of turnout over the coming days and weeks, the cry will inevitably go up that it was older voters which won it for Leave - particularly in the south, south-west, Midlands and the north east.

It is a matter of fact that the older you are, the more likely you are to make the effort to vote - 78% of those 65 or over voted in the 2015 election, compared with 43% of 18-24 year olds and 54% of 25-34 year olds.

Despite the last minute rush to register - which saw 2.6 million people sign up, many of them younger voters, between 15 May and the extended deadline of 9 June - the breakdown may not be radically different this time.

Factor in research suggesting that support for Brexit was significantly higher among those aged 55 and over than among younger age groups - three out of every five voters aged 65 or over said they wanted to leave - then you have the foundation for Friday's result.

Of course, it is not as simple as that, with many younger voters will also have supported Brexit across England and Wales. But a big inter-generational divide in voting patterns is just one of the many talking points going forward.

8. Europe always slightly alien

Image copyright AFP

The UK's relationship with Europe has never been simple nor static.

It took the country years to join what was then the European Community and, even then, when it was last put to the vote in 1975 many backed it grudgingly or for narrow economic reasons.

Many of those have since changed their minds, with their earlier ambivalence turning into outright hostility. There have been decades of scepticism towards the EU among politicians and in large parts of the UK media.

The younger generation were generally seen as pro-EU but it remains to be seen - once the details of the voting is looked into - how the result broke down by age.

What appears clear from the campaign is that the vote to Leave was as much a statement about the country's national identity, and all that involves, as it was about its economic and political future.