If you are in the UK, sitting in a darkened room looking mournfully at your photos from your Erasmus year and shaking your fist at the electorate that robbed you of an EU future, suppressing your tears of rage because they would spoil the little pattern on your flat white, please take a moment to calm down first, and then think about what just happened.
Let’s not delude ourselves: for all the benefits of the previous three decades of increasing liberalism, the societies did not become fairer to those on the low income rungs in developed Western countries, especially in the UK. Since the fall of the Berlin wall, Western societies did little to create equitable redistribution following the reduction of labour costs due to globalisation and technological revolution. Mainstream left-wing parties turned away from the redistributive concerns of the working class, in hope of eventual trickle down and pursuing worthy and politically easier issues of identity (which to some extent further alienated the working class who were ill-equipped to the new language and mores). The crisis of 2008 saw the elites more concerned with propping up the unequal system than helping the working class, who, especially in the UK, were punished though benefit cuts, while they could see luxury condos in London soar in height as well as price. With lower social mobility and almost no plans in sight in the UK (and Europe) that would make their lot better, it is no wonder people wanted to rebel somehow. All the talk of prosperity offered by the status quo sounded hollow to them, mostly because it was hollow. When you have nothing to gain in normal circumstances, and have little to lose it makes sense to gamble.
The fact that the rebellion took the ultra-right turn towards isolationism and nationalism is again to a large extent the fault of the left wing parties, usually filled with middle class do-gooders disconnected from the struggles of the working class with more will to discuss which type of socialist they are (“ooh, today I feel like I am more of an anarcho-syndicalist…Trotskyism is so last year”) than to go to the grassroots and campaign with credible (and understandable) policies. In other words, Labour party (and the like) were late to offer a narrative of how things went south for the working class to the working class (partly because any cogent narrative would require some self incrimination), and left the field open to demagogues who happily seized it and used the background of increasing Islamic radicalism to their advantage.
This does not exculpate those who actually voted for the rather strange bunch who led the leave camp (and which will in all probability cause the working class more harm than good), but it does allow us to see how to avoid the further slide to the populist right. In short, if the urban elites want to have their prosperous world of global integration back, they either need to work harder to offer credible benefits to their working class brethren, or (which some have called for today) have to eschew the mask of wanting full democracy and just start campaigning for an outright plutocracy in the West. The first option is very difficult and the second option is very unpalatable. Whichever you choose, just do not delude yourself that those who voted to Leave are simply insane and uneducated. The scariest thing is that the current system made their choice almost rational.