A republic is a king-less form of government that has no monarchy and no hereditary aristocracy. 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 also North Korea and Cuba are republics too.
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. 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.
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.