You see, Mr. Kmicic... If we, Radziwills, lived in Spain, France or
Sweden, where the son inherits the throne after the father, we would
probably serve the King and country, content with the highest offices.
But here, in this land where the King is elected by the nobles? Who
can assure us, that some day out of nowhere, they won't decide to put
Mr. Pieglasiewicz from Psia Wolka on the throne? And we Radziwills,
according to tradition, will have to come and kiss his Pieglasiewicz
hand! It is time to finish this! The Commonwealth is a red cloth at
which everyone pulls. But we, Radziwills, have decided that we should
be left with enough cloth to make a king's robe.
Quote from novel "Deluge" by Henryk Sienkiewicz, the action of which takes place during the Swedish invasion in 17th century. Pieglasiewicz is a reference to a poor, most simple noble without family traditions, while Psia Wolka references to a least important village of all.
Yes, between 1573 and 1791 there was a system called free election in Polish-Lithuanian Commonwealth. Just note that the system was abolished by Constitution of 3rd May, in 1791, four years before the fall of the country.
The electoral system instead of hereditary monarchy was introduced after Jagiellonian dynasty at Polish throne ended with the death of Sigismund II Augustus, who passed away without any heir.
The elections were taking place at the Election Sejm, which was open for all Polish and Lithuanian nobility called Szlachta (remember that the percentage of nobility in Eastern European countries was much bigger than in the West).
There were two main rules for a candidate. He had to be noble and Catholic. The obvious consequence for which was that being Orthodox, no Russians could become king of Poland during that time.
Every new king was obligated to sign two documents. First one was Pacta Conventa, which was an agreement between the particular king and the nation. You may treat it as a confirmation of the king's pre-election promises, usually containing new privileges for Szlachta.
Second one were Henrician Articles - a kind of country's constitution and king's rulebook, agreed during an election of Henry of Valois in 1573, which every new king had to follow. They were giving a great power to nobility - (in particular to Sejm - Commonwealth's parliament convened at least every two years for six weeks) in comparison with other countries. You'll find the list of them in linked article.
Of course such a system had both advantages and disadvantages. I'll count few of the latter.
Other countries had the opportunity to influence Polish internal politics, by supporting particular candidate (like with Stanisław August Poniatowski, or even the election of particular candidate could be imposed by other countries by force (like with Augustus II the Strong).
There were few times when the lack of agreement led to civil war and even occupation of Krakow and breaking into the crown's treasury to take out coronation regalia.
Few foreign kings were more interested in the situation in their own countries than in Poland, or even entangled Poland into wars that were highly unnecessary from Polish point of view.
With more and more privileges to Szlachta, with time new kings had less to say in the country, while magnates (elite of Polish and Lithuanian nobility) were more interested in their own good than the country in overall.
Now to the second question.
Did such a system mean that at least some rulers were "nobodies" like America's Warren Harding?
It's difficult to compare any of Polish kings to Warren Harding, as even all Polish candidates were from rich and important families. But I think we can recall here Michał Korybut Wiśniowiecki, the election of who is usually referred as being at least a misunderstanding.
He was a son of Jeremi Wiśniowiecki, a man of great military fame and one of the most wealthy nobles in the country, who played a big role during Khmelnytsky Uprising. But Michał wasn't as strong as him. There was even an opinion about him that "he can speak in nine languages, but is unable to say anything clever in any of them".
He was elected in the time when nobility had enough of foreign kings (after the dismiss of John II Casimir Vasa from Sweden) thanks to the reputation of the father (who was already dead) and connections of his mother and bishop Andrzej Olszowski, who made a big effort for her son to become a king.
But there was very strong opposition, led by John Sobieski, which even threatened with subverting by force. Sobieski, with great glory of military leader, became king 4 years later, after Wiśniowiecki's death and is known as one of the most successful Polish kings of those times.