In the current Brexit negotiation process. It seems that the United Kingdom will have to pay some kind of fee or 'divorce bill' as some are calling it, to the EU before they can leave. Jean-Claude Juncker has said the UK would have to pay (or at least agree to) before negotiations can continue. At the time of writing, many different varying numbers are being touted as the fee in question.
What is the reason a country haves to pay? What would happen if a country refused (or in an extreme case did not have the means) to pay?