I already won diplomatically twice, and second time I was at war against Germany and allied with France. AFAIR I was almost unanimously elected (only Germany did not vote at all and Xerxes voted for himself).
I think the best way to win such a game is to keep trading with other civs and so maintain polite relationships (gracious is not necessary).
As arsvendg explained it, someone must build UN and then call for a vote. If you build it, you can control when the vote happens; otherwise... keep attention to your relationships when someone start building it !