The primary advantage of elections is that, when fairly conducted, they provide the best expression of the electorate's political preferences. As the alternative to elections is autocratic, or dictatorial, rule, then the conduct of open and fair elections is the sine qua non of democratic government. Elections that are properly conducted exemplify all that is good about democracy. Their outcomes provide the best indication of the preferences of a majority, or at times, a plurality of the public.
Note that the above paragraph repeatedly emphasizes the fairness of elections. Elections in which cheating occurs, such as in the casting of illegitimate ballots, or when political oppression by the governing elite or party occurs at the expense of opposing parties can hardly be considered free and fair. Such has been the case in countries like Venezuela, Iran, and Russia, where one party, or an alliance of parties, controls the media and the nation's security organs and uses that control to influence public opinions while actively obstructing the opposition's ability to conduct effective campaigns. When the ruling party controls the media, as in Russia, then the public is constantly bombarded with "news" broadcasts that are heavily slanted towards the government's perspective. In addition, sabotage of opposing party offices and harassment of political operatives serves to undermine the integrity of the democratic process. Sadly, elections in the United States, especially at the local level, are too often corrupted by dishonest politicians and political operatives, and by political parties that wield disproportionate power over the media, labor unions, special interest groups, and the like.
All of that having been said, elections are essential for the functioning of democracies, and, as noted, the alternative to elections is far worse. While perfect elections are exceedingly rare, elections still, in many instances, represent the majority view while protecting the citizenry from tyranny.