Our understanding and treatment of mental illness has advanced quite a bit over the centuries -- and thank goodness for that. It wasn't so long ago that people who had been deemed "mad" (among other things) were routinely locked up and basically left to rot away in deplorable conditions. It was considered shameful and embarrassing to have an insane person in the family.
But what if that person happened to be the most powerful person in the country? Dealing with a mad monarch takes more than a little finesse. He or she could choose to execute the royal physician for suggesting that he or she might not be fit to rule. Meanwhile the country is falling into ruin. And in many places, the monarch was considered to have been divinely appointed, so questioning authority is akin to questioning one's god.
This is why history is full of royals who may not have been diagnosed as mentally ill by a medical professional, but whose actions and behaviors have qualified as "crazy" to the layperson. We'll start with a possible case of mistaken identity just to complicate things.