Where did the Greeks or the Romans find the idea of a "Republic"? What was the source of the idea? Did the idea come from philosophers, or citizens, etc.?
During the early days of the Republic, the franchise was only limited to members of certain families (aka: Patricians). This made their "Republic" very hard to discern from your typical ancient big-city Oligarchy, except that the size of their voting body was a bit bigger than is typical (in the three digits rather than two).
The fact that the franchise was so limited explains why successful generals could make a plausible claim to hold popular support rather than the elected assemblies, which is partly why the Republic eventually acquired Emperors and just became another empire.
In ancient world many peoples employed the idea of collective government. In most tribes there was a tribe's council which usually elected the military commander (whom we would call "king" or "prince"). Sometimes a tribe was divided into several genses which had their own leadership so in the tribal council only the leadership of the genses participated.
This basic organization can be seen among Germanic, Slavic, Semitic and other peoples as well. You also can see it in Iliad.
Even more the most ancient Indo-European word for king, o̯rēĝs (from which Roman rex originated) meant somebody who gives straight direction, the word director being a cognate. So the king in ancient IE society was a public position rather than a hereditary title.