A republic (from Latinres publica or "public matter") is a form of government in which power is delegated by law rather than heredity. This is in contrast to those systems of government where the ultimate power resides with the head of state, typically a monarch, theocrat or dictator, rather than a set of laws. Republican forms of government are the antipode of hereditary monarchy.

In the case of democratic republics, power is usually held by elected representatives of the people.

In a constitutional republic, those powers are derived from (and limited by) a constitution.

In other republics, this power could be delegated to a traditional group of elders such as the jirga in the transitional government of the Islamic Republic of Afghanistan. The leaders of Islamic republics such as the Islamic Republic of Iran are typically a group of elder clerics who govern in accordance to Islamic law. The mostly extinct class of People's republics are Communist countries which pretend to be governed by the people but where in reality the people have very little power, such as the People's Republic of China. In most cases (if not all), a non-democratic republic is essentially a form of aristocracy since all the power is in the hands of a group of elites. (And a lot of democratic republics can be seen as slowly going in the same direction due to the existence of an entrenched political class.)

The two labels are not mutually exclusive, though, as nothing prevents a republic from being a democracy.

A common definition of “republic” is, to quote the American Heritage Dictionary, “A political order in which the supreme power lies in a body of citizens who are entitled to vote for officers and representatives responsible to them” — we are that. A common definition of “democracy” is, “Government by the people, exercised either directly or through elected representatives” — we are that, too.[4]

This false dichotomy is usually justified by using a very narrow definition of "democracy" — a pure direct democracy — and then howling about how much the Founding Fathers hated democracy and how republics prevent tyranny of the majority. What those people fail to realize is that nowadays "democracy" is usually a shorthand for "representative democracy with a constitution and/or separation of powers" (guess which was the first major one), and those angry Founding Fathers specifically stated that they were talking about direct democracies:

It may be concluded that a pure democracy, by which I mean a society consisting of a small number of citizens, who assemble and administer the government in person, can admit of no cure for the mischiefs of faction.

[...]

A republic, by which I mean a government in which the scheme of representation takes place, opens a different prospect, and promises the cure for which we are seeking. Let us examine the points in which it varies from pure democracy, and we shall comprehend both the nature of the cure and the efficacy which it must derive from the Union.

The two great points of difference between a democracy and a republic are: [...][5]

It should also be noted that in modern times, there are only two types of functioning democracies — democratic republics and parliamentary monarchies (such as the UK).

Anyway, republics do nothing to prevent tyranny of the majority; that's what constitutions are for.

Also ironic is that up to the 1900s, the political affiliations of Democrats and Republicans in the US were pretty much flipped around,[6] and that both evolved out of Jefferson's "Democratic-Republican Party".[7]

Republics are usually headed by a President. The powers of presidents vary wildly, from mere figureheads (for example, in Germany) to absolute dictator. Figurehead presidents are often appointed by the national parliaments, dictators often force their way to power, and the rest, with limited powers, are usually popularly elected. There are a few hereditary presidencies, but these are de facto inheritances rather than constitutional provisions. The UAE president, for example is customarily held by the emir of Abu Dhabi—himself a hereditary ruler.

Republicanism is not just a form of government but a larger political ideology that tends to make more specific demands and/or requirements of democratic republics and its relationship with citizens to be considered a just form of government.[8] Almost all forms of republicanism have common agreements with each other such as the need for civic virtue, some degree of egalitarianism (being defined by citizenship), a desire to achieve human "excellence" within the Republic, emphasis on the common good, and a desire to separate the private and public sphere to some degree.

Republicanism can be considered different from liberalism despite in practice both often supporting self-rule, mixed government, and liberty. Republicanism could be considered much more "communitarian" in nature often disliking the "atomization" liberalism is viewed as supporting and believing democracy is only functional when there's an educated, trusting community where citizens act for the common good and trust one another. Whereas liberals believe people are primarily motivated by self-interest republicans believe people can be educated into being primarily motivated for the common good.

Whereas liberalism tends to define freedom as being from a lack of interference republicanism often views an absence of "domination" as being a truer form of liberty. On the upside this means republicanism has a better philosophical reason to oppose massive differences in say economic inequality with liberals very often have a more difficult time defending some degree of "enforced" moderate economic egalitarianism that doesn't conflict with their own public philosophy. On the other hand the extreme emphasis on citizen choice and a more unified political culture in which "domination" can be defined and controlled by the public could be seen as leading to events such Athens vote for the death Socrates in response to disrupting the public sphere through his incessant questioning of status quo beliefs. In practice most Enlightenment philosophers mixed liberal and republican ideologies, though while initially the latter was favored slowly over time liberalism came to dominant Pro-Enlightenment and democratic thought.

Also note that "Republicanism" can be differentiated from the totalitarian communist/theocratic/fascist republics in that the former philosophically supports a stronger republic as the end goal in-and-of-itself while the latter merely view it as a vehicle for their different political utopias with the Republic only being (theoretically speaking) a temporary necessity. In practice the former will virtually always place a heavier emphasis on elections and debate than the latter. One example of "extremist" Republicanism however would be Jacobin France which feeling enemies of liberty were everywhere enforced a nationwide purge targeting enemies of the nation.

Also "Republicanism" does not actually relate to the modern Republican Party apart from neither supporting the establishment of outright monarchy.

Classical Republicanism: The earliest form of democracy with the Greeks placing more emphasis on direct democracy and the Romans on the rule of law. Heavy emphasis on not just citizen virtue but also defending themselves from outside threats and in practice had Aristocratic classes that would occasionally weaken the more democratic aspects of the Republics. Rights were only allocated to citizens of the Republic This lead many philosophers at the time, such as Plutarch to not that extreme inequality tends to be the death knell of Republics. Citizenship was also only fully extended to free males and in practice the landowning class tended to have an even "higher" form of citizenship and like most people at the time tended to have a cultural imperialist/supremacist mindset. Arguably the finishing blow for Classical Republicanism was the transformation of the Roman Republic into the Roman Empire.

Civic Humanism: Supported by Machiavelli, these Republicans were present in late Medieval times and were partly inspired by the Classical Republics (when the ruling class wasn't using it just as an excuse to claim they weren't as bad as the absolute monarchies). Influenced later Enlightenment philosophers. Placed a heavier emphasis on commerce with examples including Venice and Florence. Despite being more democratic than the neighboring monarchies it tended to be ruled by the upper-class which famously lead to a backlash in Florence when religious fanatics briefly took over the area. A modernized version was arguably promoted by anti-totalitarian writer Hannah Arendt amongst others.

Modern Republicanism: In practice mixing liberal and republican ideas this was the concept supported by the American Founding Fathers onwards and is the form most modern democratic Republican states take. At first citizenship was often limited to landowning white males but was continuously expanded. Unlike the former Republics mixed natural rights with Republicanism. There is much internal disagreement about the form this should take as seen by splits amongst the founders themselves (such as Jeffersonian vs Madisonian vs Hamiltonian republicanism, in order of favoring least to most centralization).

Neo-Republicanism: A modern form of Republicanism supported by political philosophers who believe liberalism does not offer a robust enough form of liberty by not having enough checks on non-political forms of inequality (such as via wealth) and that the fall of communities leads to citizens whom distrust one another and will run to an authoritarian to protect them. Most famous adherents are Philip Pettit and Michael Sandel.[9] While Civic humanism places more emphasis on civic virtue and public debate Neo-Republicanism tends to trend more toward policy prescriptions and economic/social egalitarianism. Or to be dramatic about it the modern forms of Civic Humanism tend to favor an updated Greek Classical Republicanism while Neo-Republicanism is more "rule of law" focused and thus admires an updated form of Roman Classical Republicanism while also taking in more liberal influences.