A republic is a king-less form of government that has no monarchy and no hereditary aristocracy. It originates from Rome, in 509 B.C. when the Romans overthrew the Roman kingdom. Once free, the Romans established a republic, a government in which citizens elected representatives to rule on their behalf.
The national sovereignty lies in the authority of the government and not in an emperor or monarch. The word republic comes from the Latin language words res publica, which means a "public thing". For example, the United States is a republic and India is a republic, but North Korea and Cuba are also called republics. However, Britain and Canada are not republics, since they have a monarch (Queen Elizabeth II in both cases).
Countries with a king or other monarch and free elections is called a constitutional monarchy and are not called republics. A constitutional monarchy resembles a republic because the constitution has been amended to remove power from the monarch and install institutions conforming to a philosophy of republicanism. This includes the United Kingdom and the other Commonwealth realms, the Netherlands, Thailand, Scandinavian and various other countries. What makes a republic different, is that laws are made and enforced without royal authority.
The Head of State in a republic is generally a person who has been chosen by the citizens, either by direct election or by a group of elected representatives to act as the top representative of the people. In most republics, the Head of State is called the president. In some countries, the president is elected and has a lot of political power. In others, the president does not hold much direct power, but is important in the legal system for other reasons.
Sometimes a state is called a "republic" when its head is not called "king" but something else. For example, the Roman Empire had an "Emperor" and the Dutch Republic had a "Stadholder" but they worked as hereditary monarchs.
Licchavi in India was the first republic in the 6th and 5th century BCE. The earliest republics that were much imitated later were Greek cities in the eastern Mediterranean area. The biggest difference from other city-states at that time was that people chose their leaders by voting. The votes were counted, and the person with the most votes won.