Summary:
All Civilizations and City-States have a vote. In addition, the Civilization which built the United Nations gets one bonus vote attributed in their favor during elections.
Civilizations cannot vote for themselves. They will vote for the other Civilization they have the best relations with.
City-States will vote for the Civilization they are allied with, unless they've been liberated, in which case they vote for their most recent liberator. If a City-State isn't allied with any Civilization, they won't vote.