What does Britain leaving the EU mean?

Britain has voted to leave the EU. What does that mean both for Britain and the European Union?