To vote in an election or a referendum, you must be on the electoral register. It's easy to sort this out. Just go to www.gov.uk/register-to-vote.
You can register to vote if you are 17 years old, however, you can only currently vote when you become 18 (the Liberal Democrats back votes for 16 year-olds!). You need to be a British citizen or a Commonwealth citizen who has leave to remain in the UK, or does not require such leave.
If you have moved house, or recently changed your name (eg. after getting married), then it's vitally important that you update your details on the electoral register.
Similalry, if you think there's a danger you might be away on the day of the next election, then make sure you register for a postal vote, so that you'll still have a chance to cast your ballot. You can do this at www.gov.uk/register-to-vote too.