So wouldn't that depend upon the king? A warrior king who got his power through conquest would be different than a king that inherited the crown and just partied. (Charlemagne vs Louie XVI).
It makes no difference in whether I would give class levels to a king. It's quicker prep for me to I write a statblock without flipping through the Players handbook to look up class rules.
If you're asking about hit dice, it does depend, but not much. Charlemagne is among the very few historic examples I'd give more hit dice. But that's more because he's a Hero than because he's a king. I'd give Arthur more, too. But I don't consider a soft Louis, a battlehardened Henry or a veteran Caesar (Tiberius, say) aren't different enough from each other or the average human for me to do anything but give them my standard 2 hit dice.
But how about the king's champion? Or the court wizard? What about other adventuring parties that come in conflict with the PCs?
I can't answet that first question, since I've never considered whether or not the king has a champion. That's a real oversight on my part, since the idea has an obvious place in the setting. I mean, how have I not introduced a sports reference by holding a tournament where Adventuring parties compete to be the King's World Champions? And, oh! Now I can answer that first question.
The king's champions would indeed have class levels if the players won the tournament, probably not otherwise. I've already statted up roughly dozen rival delvers, because the setting heavily involves the PCs (mostly) friendly competition with other parties. I've given each between 2 and 8 hit dice. I didn't build them with class levels, though, because, again, it takes much to long.
Oh, and the closest thing to a court wizard is the sage who is acting as a primary quest giver by asking the players to map out the dungeon. Despite being fundamental to the campaign, he still hasn't been given a statblock, existing in my notes as nothing but a name. And so like the king, he's got 2 hit dice.
There are all sorts of NPCs that could and should have class levels. The most difficult challenge of any version of D&D has always been an equivalent leveled party.
Dragons have killed more PCs than any other encounter in my experience. I fundamentally disagree with that should. I'm also wholly uninterested in discussing shoulds.
My favorite part of EnWorld, though, is reading about other people's experiences:
. . .Currently my party is facing a 4th level goblin wizard who focuses on illusion and enchantments. The goblin survived the massacre in the very first goblin cave in the starter adventure and promoted through play from a mook to a mid-level boss. He has escaped two encounters with the party before as well as tormented them by his continued survival. He is likely to survive (though not guaranteed) the current encounter . . .
This sounds fun. If my players ever wind up facing too many devil warmages (the megadungeon is simply lousy with devils! The players are lucky if they can get in a short rest without being rudely interrupted) I should give them some illusion or enchantment stuff.