Court Mage

In fantasy series it's fairly common for a king or other high-ranking ruler to keep a magic-user on staff, primarily to provide mystical advice and services, and possibly general wisdom as well. Can also show up in historical fiction or even Real Life, as during time periods when sorcery was widely believed in having a mage or alchemist on hand was generally seen as a smart idea. The character can be The Good Chancellor, the Evil Chancellor, or anything in-between. Contrast The Magocracy and Sorcerous Overlord for instances where the mage(s) is actually the ruler, rather than an advisor. If the character has high standing among other mages as well as the king, they're also The Archmage. If this is common and magic is real and powerful, one may have to ask why the wizards don't run things.

Anime and Manga

 * Madam Suliman in Howls Moving Castle.

Literature

 * Merlin, of course. Unquestionably the Trope Codifier.
 * Both Gandalf and Saruman from The Lord of the Rings have done stints as advisors to various monarchs.
 * Binnesman and Raj Ahten's flameweavers from The Runelords.
 * Marwort the Illustrious was this to the Kingpriest in Dragonlance, despite the latter's well-documented Fantastic Racism towards wizards (it only worked out because Marwort swore never to use magic without the Kingpriest's permission, and then never in his presence). Other wizards, of course, considered him a traitor. Later on Fistandantilus took the job for his own ends.
 * Tayschrenn in the Malazan Book of the Fallen.
 * Skeeve becomes one early in the Myth Adventures series. His mentor Aahz insists it's a cushy job, where all you have to do is show some parlor tricks and be a status symbol. As it turns out, the king expects Skeeve to single-handedly face down an invading army...
 * The Bible ascribes court magicians to Pharaoh (Exodus 7 and 8) and to the King of Babylon (Daniel 1, 2, 4, and 5).
 * Confirmed at least for Egypt in historical sources: a Pharaoh always had a court mage and a physician on the payroll - the latter was expected to perform mystical healing arts as well as mundane, thus overlapping the role somewhat. It's believed that the death of at least one Pharaoh was indirectly caused by a treacherous court mage removing the divine protection from him, and getting caught in the act - placebo can work in both ways.
 * In Chronicles Of The Black Moon, Ghorgor Bey's sworn enemy keeps a mage by his side. Quite hilariously, when Ghorgor slaughters the entire castle guard and advances on the two, the lord orders the mage to kill him, at which point he says "I'd love to, your lordship, but I've got a teleport on the boil!" and teleports away.
 * Many Qirsi have this as a profession in The Winds of the Forelands.
 * Flagg from Stephen King's Eyes Of The Dragon is the King's magician and also an Evil Chancellor.
 * In The Last Unicorn, Schmendrick becomes one of these for King Haggard, displacing his former court wizard Mabruk.
 * Rulers in The Wheel of Time commonly have an Aes Sedai adviser. Most of the time its kept secret, however, due to the Fantastic Racism against them.
 * Cimorene, from The Enchanted Forest Chronicles, learned some magic from her father's court mage before she was told that magic wasn't a proper pursuit for princesses.
 * Several examples in Tamora Pierce's books, with probably the straightest being Ishabal Ladyhammer of The Will of the Empress. The plot of the book is the four leads trying to escape becoming this themselves.
 * The Imperial Saik from the Prince of Nothing books are an entire order of Court Mages.
 * The King's Sorcerer, Suliman, in Howl's Moving Castle.
 * In A Song of Ice and Fire Melisandre serves as a combination of court mage/religious adviser/oracle to Stannis. In later books,  becomes this to  . Danaerys briefly has Mirri Maz Duur, but it ends badly for both of them.
 * A popular profession among the titular Magisters of the Magister Trilogy. Kings consider these immortal, nigh omnipotent sorcerers indispensable to their reigns.
 * Serving a term as a Court Mage for a minor lord is a standard step in a magician's career in the Witcherworld. High-ranking magicians are independent, but often advise kings and other rulers.

Video Games

 * Donald Duck holds this position in Kingdom Hearts.
 * One ending of Dragon Age has Wynne become this for the king or queen. The Player Character can also assume this role if they choose.
 * In the Expanded Universe novel The Stolen Throne, Severan serves as this to the Usurper King Meghren. Since Meghren is completely insane, this means that he gets to run the country behind the scenes.
 * Delfador in Battle for Wesnoth.
 * Evil Chancellor and Mad Scientist Lord Yuna serves this role to Emperor Soniel in Breath of Fire IV.
 * In The King of Dragons, atleast according to the SNES manual, the king of Malus has an advisor in the wizard Guindon.
 * Merlin reprises his usual role in Knights of the Round.
 * Kefka Palazzo, the Monster Clown Big Bad of Final Fantasy VI, serves this role to Emperor Gestahl.
 * The Elder Scrolls V Skyrim sees several court mages; every major hold (IE: with walled-in city as its seat) has a court mage, and two of the four lesser holds have one. They serve as local vendors for various magical paraphernalia and their quarters/laboratories have alchemy and enchanting stations in them.
 * The Imperial Battlemage is this for the Emperor. The first known, Zurin Arctus, betrayed or was betrayed by his Emperor, while the second known, Jagar Tharn, used magic to exile the Emperor and assume his appearance and rule. High Chancellor Ocato may have been this, or may have been a leading advisor that just happened to be an Imperial Battlemage as well.
 * Rone from Avernum counts for the titular kingdom of that game, whereas Garzhad is the court mage for the Empire.
 * The King of Enrich from Shining the Holy Ark has two. His old trusted Good Chancellor; Sabato, and an evil old hag that turned up a few months ago (in which time the King has gone a bit strange); Rilix.

Web Comics

 * Osric from the Sluggy Freelance Story Arc "The Storm Breaker Saga."

Western Animation

 * Waterbending Master Pakku could be seen as Avatar: The Last Airbender's version of this in the Northern Water Tribe, while the Earth Kingdom's Long Feng is a more malevolent version.
 * The Magus to Princess Katherine in Gargoyles. The Archmage previously held this position to her father, but was banished for attempting to usurp the throne with his powers.
 * Hotep and Huy from The Prince of Egypt, though it's unclear if they really have powers beyond clever sleight-of-hand.
 * Ixis Naugus was originally this in Sonic the Hedgehog. He was one of the few beings War Minister Julian feared (because Julian's technology couldn't do jack against him), so when he decided to explore the Void Julian took the opportunity to leave him stuck there.
 * In ThunderCats (2011) Apart from being head of an order of Church Militant Praetorian Guards, Jaga holds this position in the court of Thundera's King Claudus, which means that all his subordinates are also Kung Fu Wizard Magic Knights.

Real Life

 * Thrasyllus, Sr. and Jr. -- court astrologers of Tiberius and Nero
 * Angelo Catto -- court astrologer of Louis XI of France
 * Guido Bonatti -- official astrologer of the city of Florence
 * Michel de Notredame (Nostradamus) -- court astrologer of Catherine de Medicis
 * Lucas Gauricus -- court astrologer of Popes Leo X and Clement VII
 * Dr Faustus is often associated with the court of Charles V
 * Dr. John Dee -- magician associated with the courts of Elizabeth I of England, Stephen of Poland, and Ruldolph II of the Holy Roman Empire (also associated with Rabbi Loew, the creator of the Golem)
 * A worryingly recent example is Joan Quigley, the astrologer whom Nancy Reagan infamously consulted to help plan her husband's schedule while he was President of the United States.