Summary:
If you take a City-State that has been captured by another Civilization, you have the choice to annex the City-State, make it a puppet, or liberate it. If you choose to liberate a City-State, then it will always vote for you in UN elections, no matter what its relations are with you at the time of the vote. If the same City-State has been liberated more than once, it will vote for the Civ which liberated it most recently.
If a Civilization has been removed from the game and you capture one of that Civ's cities, you have the option of annexing it, making it your puppet, or liberating it. If you choose to liberate it, the Civilization returns to play and will hold you in high regard. And while you are not guaranteed their vote in the UN elections, this huge positive modifier should make it easier to convince them to vote for you.