The head of state is the figurehead of a state, who represents the unity of the state. However, the head of state may not have very much real power.
In a modern republic, the head of state is a president, usually elected by the people or by a parliament. In a monarchy, the head of state is the king or queen. Some countries have different systems - for example Recep Tayyip Erdoğan of Turkey is both the Head of State and Head of Government which is known as an executive system.
In a modern monarchy, the head of state usually has little real power. Instead, the most powerful person is the head of government. This is usually the leader of the political party that wins the most seats in an election. In these cases, the king is considered to be the leader of the country, but must always take the decisions that the head of government advises them to make. The king or queen carries out national ceremonies. The United Kingdom works like this, with the Prime Minister heading the government.
A president may be the most powerful person in the country. This is true in the United States. However, sometimes there is a head of government, as well as a president. The president then acts very much like a king or queen, leaving the real decisions to the head of government. The Republic of Ireland works like this.