A kingdom is technically a monarchy, which was the most common form of government on Earth until the republic took that honor. In fantasy worlds, it’s probably the most common, whereas federations seem dominant in SF. In a monarchy, one person (the monarch) is the sovereign until death or abdication, though there have been cases of a monarch serving for only a few years, with this planned in advance. This is done to achieve a goal, like quelling an insurrection. When the crisis is over, the monarch steps down.
Someone can simply announce they are a monarch after seizing power, as Napoleon did in France to create the First French Empire. Doing so resulted in other European countries repeatedly attacking France as a unified coalition because none of them wanted a French Empire. He rebuffed them but eventually succumbed.
Monarch titles are familiar: emperor, king, duke, prince, and so on.
Succession
Monarchies are typically hereditary, where only members of the family (usually male) can become monarch. Heirs are raised in a royal family and taught what is expected of them, and if the same family rules for generations, it’s called a dynasty. The heir is most often known in advance to ensure smooth, uncontested transition. George R. R. Martin’s A Song of Fire and Ice (aka Game of Thrones) is largely based on the failure of smooth succession. Competing ideas on who is the rightful heir can cause strain and outright war.
An heir can be chosen according to the proximity of their bloodline to the king. A son is in close proximity while a cousin is farther removed. Primogeniture is different and stipulates that the first born male is to inherit everything, followed by younger sons, then daughters, and finally siblings. We don’t need to know too much about this for world building unless getting further into the details of a kingdom to tell a story there.
The rules for succession vary so that we can invent our own if desired. We could decide that the king’s eldest son is next in line but only if he’s been a knight or star fighter in the past. This becomes justification for forcing military service on a prince, but maybe such a prince fails and the next oldest male heir is now first in line to the throne. The quality of one’s bloodline can be a determining factor, as can religion, age, and even mental capacity. The most famous disqualification is gender; our modern audiences might prefer the abolition of that one. Sexual orientation could also be used, one justification being that a homosexual is less likely to produce an heir.
Another option is for those within a group to elect the next monarch from those who are eligible. Maybe the next king must be a wizard, and this requirement trumps everything else so that even someone who is otherwise unqualified to rule becomes king. In SF, it could be a scientist chosen by other scientists. We can decide there’s a reason for this, such as this specialized skill set enables the fulfillment of the king’s duties. Or we can just decide it is part of the kingdom’s constitution and never remark on why that is until we think of a rationale.
Absolute Monarchy vs. Constitutional Monarchy
In an absolute monarchy, the monarch has unrestricted power over the people, who have little or no say in government. He can enact laws by decree and impose punishments. He has full control over the military. In practice, he may be limited by a priesthood, the aristocracy, or middle and lower classes. The monarch also needs help from an inner circle that often acts like an oligarchy, since many are relatives. An absolute monarchy often gives way to a constitutional one.
If a constitution exists to place limits on the monarch, that’s called a constitutional monarchy. The monarch is often the head of state but not head of government, making him largely ceremonial. Some constitutional monarchs are also head of government and have considerable power. Otherwise, power lies with the legislature and a prime minister who is head of government. Other powers can exist due to laws, precedent, or tradition. The monarch has an official residence and sovereign immunity (he cannot be sued and technically can do no wrong because the government is considered responsible). Succession is usually determined by law of the constitution.
Other Limits
A monarchy might not be absolute due to other limitations, such as military groups who retain authority over themselves and dominate the monarchy. In ancient times, there were several instances of the military electing a monarch or even killing one before replacing him; the Praetorian Guard of Rome exemplified this.