In a republic, instead of voting directly about what they want to do, as in a democracy, people instead vote for people to represent them, and those people decide what to do.
The first republic was the Roman Republic, which was founded about 509 BC, just about the same time as the first democracy in Athens. The rules about who could vote were about the same as in Athens too: slaves couldn't vote, and neither could women, or children, or men who were not citizens. In addition, in Rome you could only vote if you owned land, so a lot of poor men could not vote at all even though they were free citizens.
The republic was a lot more efficient than the democracy,
because most men who could vote only needed to vote in the big elections,
and the rest of the time they could be at work. Only the Senators, the
elected representatives, had to be voting all the time. And men who
had been elected to be judges or to run the city, those were full-time
jobs: consuls, tribunes, quaestors (KWEE-stores), and praetors (PRY-tores).
(Only people who could vote could be elected, so only free men who were
citizens and owned land could run for office).
But the aristocrats (the rich people) fixed it so that it was pretty much impossible to elect anyone who wasn't already an aristocrat to the senate or to be a consul or a tribune or anything. So this republic was a lot like an oligarchy in that it tended to be run by rich people.
Hasdrubal, a Carthaginian
At the same time, in Carthage (Africa), there was a very similar government. It was a republic as well. The chief magistrates or officials were two shopfets (suffetes in Latin) who were elected annually on a basis of birth and wealth: this is almost identical to the Roman system of electing consuls from among the patricians.
Military commands were held by separately elected generals: this is different from the Roman system, where the consuls were the generals. In addition to these leaders, there was a powerful "senate" of several hundred life members, again, as at Rome. The powers of the citizens, or the Assembly, were very limited: basically they could only vote for the magistrates. There was also a separate group of 104 "judges" who scrutinized the actions of generals and other officials to keep them honest.
After the Romans destroyed Carthage in 146 BC, and the Roman republic collapsed about 30 BC, there was not another republic for about a thousand years. Then in the Middle Ages, around 1100 AD, there began to be small republics in various northern Italian cities like Venice, Florence, Siena, Pisa, Genoa, and Milan. Sometimes these cities joined together into the Lombard League, but often they acted independently. Like the Roman and Carthaginian republics, however, almost all the power still was in the hands of rich people, so that these republics were a lot like oligarchies.