This chart from BBC, based on Ashcroft's poll of over 12,000 voters is quite revealing and explains why we've ended up with this outcome.
Old people are more likely to vote Leave (and let's face it, are more likely to be racist as well!). Crucially, old people are more likely to vote. The areas with the oldest population had higher turnouts than the younger areas.
What's somewhat galling is that the vote was swung by pensioners, who basically don't have to face the same consequences that the rest of us do. They don't need to worry about redundancy or their future job prospects. They have a guaranteed income that is also guaranteed to increase every year whatever happens. They pay little income tax so don't need to worry about the fiscal consequences of an economic downturn. They don't have mortgages, so don't need to worry about possible increases caused by our worse credit rating.
They are, however, the heaviest users of the NHS, and would no doubt have been tempted by the claim that leaving the EU will free up £350m a week for the NHS, which Farage admitted mere hours after the polls closed was a false claim.
What a mess.