What led to Brexit?

It has been three years of political drama ever since the UK voted to leave the EU. But how and why did Brexit start?