(covers information from several alternate timelines)
An election was a process through which a group selected individuals to hold political office. Regular and fair elections were an important aspect of democracy.
Following the fall of the Klingon Second Dynasty in the 16th century, the Klingon Empire was ruled by a council elected by the people. This was the first and only experiment in Klingon democracy and was known for producing several notable reforms. 24th century Klingon historians were critical of the period, naming it "The Dark Time". The experiment ended after 10 years with the beginning of the Third Dynasty. (DS9: "You Are Cordially Invited")
Gosheven was the leader of the Human colony on Tau Cygna V in 2366. In that year, the Sheliak demanded the colony's removal, and Lieutenant Commander Data was dispatched from the USS Enterprise-D to arrange the evacuation. Gosheven refused, and reminded his people that they had elected him as their leader in order to dissuade them from listening to Data. (TNG: "The Ensigns of Command")
The Kai of Bajor was elected by the Vedek Assembly. Vedek Bareil Antos was the favorite to succeed Opaka in 2370. Bareil dropped out of the race when he was implicated as a collaborator in the infamous Kendra Valley Massacre. His main rival, Winn Adami, was subsequently elected Kai. In fact, Bareil had dropped out to protect the memory of Opaka, who had allowed her own son and 42 other Bajorans to be killed during the Bajoran Occupation to prevent over 1,200 deaths in the Kendra Valley. (DS9: "The Collaborator", "Life Support")
An election to determine the First Minister of Bajor was held every six years. In the 2371 election, it initially appeared that Kai Winn, who had recently assumed the role of acting First Minister, would be unopposed. However, Winn's heavy-handed attempts to reclaim soil reclamators from farmers in Dahkur Province precipitated a political crisis in which Winn was eventually forced to withdraw from the race and support the popular leader of the rebel farmers, Shakaar Edon, in his bid to claim the position. Supported by the Bajoran Militia, Shakaar was able to easily defeat the one or two other candidates in the election. (DS9: "Shakaar")
The President of the United Federation of Planets was an elected position. In 2372, President Jaresh-Inyo remarked that he had never sought the position, and had almost turned down the possibility of submitting himself for election. When it was revealed that Admiral Leyton was attempting a military takeover of the Federation, Captain Benjamin Sisko reminded Leyton that Jaresh-Inyo had been legitimately elected, and as such Federation citizens would be unlikely to accept his removal. (DS9: "Homefront", "Paradise Lost")
When Akorem Laan briefly assumed the role of Emissary of the Prophets and ordered the return of the D'jarra caste system in 2372, he expected that First Minister Shakaar, a farmer by D'jarra, would have trouble being re-elected to a political office. (DS9: "Accession")