What happens when you can't pay your debts?
I usually run a good fiscal policy, so my gold is always positive. I've read somewhere that if you get to 0 gold, units start to sell themselves. Are there any other repercussions?
What happens if you have a trade agreement with someone and you need to pay them X gold per turn, and you just don't have the money to give? Do they still get the money? If an AI civ runs out of money but still needs to pay you, do they still get the money?
I often see AI civs with 0 gold and a deficit, but they still seem to be able to field an army. How can that be? Is this behavior exclusive to AI civs?
Solution 1:
As Shaun said, the difference is initially taken from your science generation. After that, your units will slowly begin disbanding.
Typically, it will take longer than 45 turns for your economy to completely fall apart, so by the time any trade agreements become an issue, they'll usually have ended anyway. If, however, you've tanked your economy fast enough then you will continue paying the AI any gold you owe them as a regular expense. I was able to test this by losing over 40 gold per turn without any science generation, and my trade agreements continued as per normal. If the AI is out of science, gold, and units they will still pay the player as well (I can vouch for this as this has happened with me and Gandhi a number of times).
To repeat Shaun's answer about the AI being able to field an army without any gold, it's because they're losing enough science generation that they do not have to suffer additional troop penalties.