Short answer: because David Cameron is an idiot.Why was membership of EU put to the vote in a referendum? This is surely a decision for government given the complex economic issues it raises, not to mention the social implications. Public opinion isn't a yardstick for what's right economically, socially or politically. There are some things which should never be put to a public vote. Should we be taxed? Should beer be free? Should *****philes be castrated, then brutally slaughtered? The Brexit vote is of that ilk.
Long answer: so much of Cameron's Premiership was based on him doing nothing for several years, meaning he had to take a huge gamble in order to compensate for his lack of leadership (as well as to distract attention from the combination of asset-stripping and incompetence he and his cabinet were getting up to) A fine example of this was the Scots referendum from a couple of years back, where Cameron had two years to prepare, yet when he realised that Project Fear wasn't working he had to throw all manner of concessions north of the border at the last minute in the hope that it did enough to sway the vote. Same could be said of the EU Referendum, a referendum he pitched in a transparent effort to get some short-term political gain, but once more he failed to set out a coherent argument for staying in the EU and instead returned to Project Fear tactics even though they damn near cost him two years previously, as well as failing to take into consideration that for a worrying number of people in this country The Sun is The Word of God - and that worrying number of people all paid more attention to the Two Minute Hate campaigns on their front page than a coherent argument Cameron didn't make.

