What will happen to Gibraltar after Brexit?

Gibraltar is a British overseas territory that shares a border with Spain. Why is it the cause of so much fuss between the UK and Spain? And what's it role in Brexit?