A republic is a type of government that has no king, queen, or other monarch and where the people are sovereign. This means that people can choose leaders to represent them and make the laws. The word republic comes from the Latin language words res publica, which means "public thing". However, in practice some nominal republics are actually dictatorships, such as the Russian Soviet Republic and the other republics of the USSR from 1922 before it was dissolved in 1991.
Countries with a king or other monarch and free elections is called a constitutional monarchy. This includes the United Kingdom and the other Commonwealth realms. What makes a republic different, is that the people do not need the permission of a king, or other higher power, to choose leaders and the type of government they want. Laws are made and enforced in the name of the people.
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 a lot of 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 other earliest republics were Greek settlements in the Mediterranean sea. The biggest difference from other city-states that were around then was that people could choose their leaders by voting for them. The votes were then counted, and the person with the most votes won.