When the king dies and his child or children are underage, a Regent may be appointed from amongst the top nobles to rule until the eldest son (or eldest daughter if there are no sons or the monarchy is a Queendom) is old enough to rule in his or her own right. This does not, however, keep the country safe from royal tyranny if an adult monarch starts acting up. Also, certain Regents who wish to carry on ruling have a tendency to cut the heir with a knife.
2-Noone Is Above The Law
If a monarch starts blatantly breaking the laws in a big way to the point where the safety or the stability of the country is being threatened, then the judges of the High Court can impeach the monarch and have him or her arrested and someone else named monarch. The dangers are twofold; a clever monarch can rewrite the laws to make impeachment nearly impossible, or the judges can become the true rulers of the land in a de facto kritarchy and then themselves misbehave.
The king sits on a royal council of the most important nobles, and whilst he chairs the council and to an extent has control over what exactly is put before it, he has only one vote and can quite easily be outvoted by the nobles. In this way stupid, megalomaniacal or frankly idiotic kings can be outvoted, yet the monarchy is more then a mere figurehead. A persuasive monarch can have a surprising amount of power under this system.
When the old monarch dies, the chief wizard of the royal court secretly casts a spell that swaps the spirits of an average person living outside the royal court and the spirit of the monarch. The idea behind that is that the new monarch will be a man/woman of the people, knowing what the average person thinks, rather then some snooty out of touch noble. The wizard might well fear that despite his or her gratitude, the new monarch might order his or her assassination.
Times have changed, and the monarch has lost all or nearly all of his/her power, perhaps after a civil war. The monarch stays completely or nearly completely out of politics and just enjoys a life of luxury. Perhaps the real government is now elected by the people; or a military dictatorship; or a council of the rich nobles and merchants. The monarch does still have some value as a symbol and as the Captain-General of the army; if someone tries to do a coup, he or she can order the armed forces not to obey the coup leader and the armed forces will most likely obey the monarch.
6-Call A Doctor
Although the monarch is an autocrat, if all the leading royal doctors are asked one by one if the monarch is insane and they all agree, the royal ministers can have him or her stripped of the crown, deposed and sent to a lunatic asylum. The disadvantage here is that if the doctors are bribed, they could quite easily wrongly declare a perfectly sane monarch insane because someone else wants the crown.
If the country starts to seriously suffer under the monarch's rule, be it a famine, a stock market crash that turns into a severe depression or just widespread public unrest and hatred of the monarch, the chief priests declare formally that the monarch has "lost the mandate of heaven" and order that he or she be handed over to them. If this is done, the monarch is publically bound to an altar, publically sacrificed to the gods and, depending on the funeral customs of the country, either cremated on a huge pyre or buried with a few grave goods in a barrow, and if there is no adult heir capable of ruling the chief priests choose the new ruler from amongst the leading nobles.
Additional Ideas (1)
The magic item:
The crown (or some similar item) is a sentient item with the power to "choose" a fit king.
If it think the king is no longer worthy of the title it's impossible to make the crown stay on the head of the king. The crown is also almost indestructible.
This of course may lead to attempt to hide the real crown and replace it with a fake one.
The fake king:
The king is killed and replaced by a wood construct that's magically "made alive", something on the line of Pinocchio. But still under the control of his creator.
This "geppetto" would adjust the construct to fake aging and maybe even create a "son" and a "wife".
Of course the creator could be a even worse ruler.
SPOILERThis is inspired by fables/SPOILER