'Democracy' comes from the Greek words demos and kratos ('people power' or rule by the people'). It signifies a type of government where the people control or are the government, as opposed to rule a monarch (one ruler), a dictator (0ne ruler) or oligarchs (a few rulers).
There are two general kinds of democracy: a direct democracy, where the people rule the country themselves (that is, they meet regularly and decide on laws and actions); or a representative democracy, where the people elect councillors to represent them in a ruling council. Many of the ancient Greek city-states and early New England colonies were direct democracies, while countries like the United States, Germany or France are far too large for direct democracy to be a viable option, so these countries use the representative democracy model instead.
'Republic' comes from Latin words res publica, meaning 'thing of the people'. It refers to any style of government where there is no monarch - that is, there is no king, no emperor, no shah, no sultan or any other similar position. In a monarchy, the government is effected by the monarch. So, for example, in the United Kingdom, Queen Elizabeth rules. However it is a 'constitutional monarchy, and the constitution effectively gives power to the parliament elected by the people. But in a republic, there is no such rule - the country is said to belong to 'the people' - but this can be via a president, a council or a parliament or a combination. This is what distinguishes it from a democracy - a republic can be a democracy or an oligarchy.
So every democracy is a republic, but not every republic is a democracy. For example, the United States is both a democracy and a republic. Some countries are republics, but are not considered democracies. Examples include Nazi Germany, the People's Republic of China, the Democratic People's Republic of [North] Korea, and the Union of Soviet Socialist Republics. While not 'democratic' countries from a Western point of view, they are technically republics, since they had no monarchs and even had some form of elections. However, it's also a matter of perception - for example, North Korea calls itself a 'democratic people's republic' and tries to brainwash its people into believing that, but from an outside point of view, it is arguably the most undemocratic country in the world.
By the same token, countries like the United Kingdom, Belgium, and Japan are not republics - since they each have a monarch of some kind (UK has a queen, Belgium has a king and Japan has an emperor), they are each technically a monarchy. However, they are each also considered to be a 'constitutional monarchy', because each has a constitution that gives real power to elected assemblies and the monarch's role is mostly ceremonial, coming into real play only when a constitutional crisis cannot be resolved by the elected assemblies and direction to resolve this is essential. So each of these has a government that resembles a representative democracy.
So these various terms are largely superficial, and the only way to understand them is to examine the real practice of government in each country - looking behind the titles, words and pretenses, and arriving at the real effective forces of government.
Development:
The early experiments in democracy were carried out in Athens and other city-states in Greece. They tried Direct Democracy, where the citizens met fortnightly in assembly and voted on all issues and a council implemented them between meetings. Some rash decisions by the easily-swayed people brought about chaos and collapse, so later countries have used Representative Democracy where the citizens elect representatives to a parliament which directs the state on the citizens' behalf. While not perfect as the representatives play politics and self interest, it is also practical for the present as countries are much larger and assembly of citizens impracticable. Mass electronic communication can solve this, but politicians are not going to rush to a system which replaces them any time soon.
Chat with our AI personalities
Most simply, a democracy refers to any form of government in which the people vote either on policy or for politicians who will themselves vote on policy. When people vote directly on policy, it is called a direct democracy. When people vote for politicians who will themselves vote on policy, it is called an indirect democracy. There are many forms of indirect democracy and one of these forms is a republic, wherein people typically vote for legislators, some executives, and some members of the judiciary.
It is worth noting that the term "republic" is also used for non-democratic oligarchic governments that simply lack a monarch, such as the Communist Republics, but the term is generally understood in a democratic context.
I endorse reading the Community Answer for more details.