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.?
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.
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.
If we take the English etymological translation of the Latin word, "Republic", it means, "The public/people's entity"-("Res"= entity and Publica = "The people"). The earliest known "Republic" in Western History-(and perhaps World History), was Rome; from about 500 BC/BCE, until 26 BC/BCE).
The Greeks, specifically, the Greco-Athenians, established the world's 1st Democracy. If we take the English etymological translation of the Greek word, "Democracy", it means, "The rule/power of the people"-("Demos" = people and Cracy/Kratia = "Rule/Power"). Greek Democracy's origins could be traced to its earliest known Statesmen, Solon-(circa 600 BC/BCE), until the arrival and conquest of King Philip of Macedon around the 340's BC/BCE.
Plato's, "Republic", is an interesting English translation, because his actual Greek title of "The Republic", was "The Polity" or "The State". Plato wrote "The Republic" around the 380's BC/BCE-(approximately 100 plus years after the founding of Rome's actual "Republic").
If one was to compare or contrast-(from an English linguistic context), Rome's actual "Republic" to Plato's written "Republic", they are two very different Republics.
The Roman Republic was relatively democratic, though placed a great emphasis on what we would today call, "Representative Government" whereby The Senate wielded a great deal of power-(The U.S. Constitution's "Articles", essentially structured and modeled the early American Government after Rome's Republic, whereby the Congress, and not the Executive branch, wielded and controlled most of the Powers of Governance).
However, Plato's "Republic"-(or "Polity/State"), though similar in meaning to the Latin, "Republic", was far different both conceptually and pragmatically. Plato's "Republic" vested the Power of the State with The Philosopher-King. Plato's "Philosopher-King" concept was absolutely inimical to Greco-Athenian Democracy and very distant from the notion that a group of Senators should be the Primary Stewards of the State-(i.e. The Roman Republic).
So, as you can see, the same word, "Republic", had different etymological meanings and in turn, produced very different historical results.
(A side historical note: Plato, in his younger years, attempted to overthrow the Tyrant of Siracusa in Eastern Sicily on more than occasion. For Plato, the city of Siracusa was the perfect place for installing and implementing his Philosopher-King vision. His plans failed miserably and he barely escaped assassinations ordered by the Tyrant of Siracusa. In other words, Plato's "Republic", was and continues to remain, a concept, an idea, as well as a failed attempt towards Statehood; whereas the Roman "Republic", was a strong and very pragmatical political system which lasted for nearly 500 consecutive years).