Summary:

All civilizations and city-states have a vote. The civilization which possesses the United Nations has two votes.
Civilizations always vote for themselves, unless liberated, in which case they vote for their liberator.
City-States vote for the civilization with the best relations, unless they've been liberated, in which case they vote for their liberator. If a city state is not allied with any Civ, it will abstain.