During the last UK election, The Conservative Party (Tories), led by Prime Minister David Cameron, faced pressure from the far right party (UKIP) over refugee immigration and jobs. Just like in the US, there is concern about the cultural values being brought in by accepting (Muslim) refugees. But the UK also has the added factor of economic immigration from within the EU, mainly from Eastern Europeans. Because many British people are still suffering the effects of the recession, they naturally believe that immigrants are taking their jobs.
The far righties wanted Britain to leave the EU because as a member, you agree have certain elements of your country being collectively determined by the main EU body in Brussels. The mainstream Tories were ok with that tradeoff, but far right people didn't like that because they're nationalistic and they want complete sovereignty over their affairs. So in order to appease the far righties, David Cameron said that if they vote for him, he'll set up a referendum so the country can decide if they want to stay in the EU or not. That referendum was last night, and to many people's surprise, they voted to leave. PM Cameron just said he'll step down in October.
The left faced a similar dynamic. Far leftists dislike the EU because of how it allows bigger nations, like Germany, to dominate smaller nations, like Greece. Basically, the EU isn't leftist enough for their liking. The Labour Party is the mainstream leftist party, but they recently elected Jeremy Corbyn (The British Bernie Sanders) as their leader. He's being criticized right now because although Labour's official position was Remain, he was was pretty

in his efforts to promote Remain. People are calling for his resignation as well.
The markets are going wild and the British currency is tanking because Britain will have to renegotiate all the things that being a member of the EU already covered. Their future is looking precarious and unknown.
TLDR: The far left and far right are expressing a dissatisfaction with the centrist, mainstream elite from both parties. It's a similar dynamic as what's taking place in America right now. Many people voted to Leave the EU as a "fukk you" to the mainstream centrists who are telling them to Remain. They believe the mainstream from both sides are profiting from globalization while leaving the little guy behind. There's a lot of history between Britain, and Europe, and the formation of the EU, and British national character that I skipped, but I'll go into it if you want.