For me, the character of Merlin is of much greater interest than King Arthur - since I can identify much more closely with Merlin. And Merlin seems to be the basis of most more recent wizards (and druids) such as Gandalf, Getafix, Catweazle and Dumbledore.
The major basis of this resemblance seems to be a Latin poem called Vita Merlini (Life of Merlin) written by Geoffrey of Monmouth in about 1150 and circulated among his friends: a single complete manuscript survived; and I recently read a literal prose translation.
The history of this poem is analysed by Count Nikolai Tolstoy in his wonderful book The Quest for Merlin of 1985. It came some 15 years after Geoffrey's blockbuster bestseller Histories of the Kings of Britain - which is the main medieval source for King Arthur and has a few references to Merlin.
Life of Merlin seems to be the product of considerable research and compilation of earlier, probably much earlier, sources. It has a rather rambling plot and structure - as if it was made by arranging and linking several existing works. There are large passages of teaching and prophecy, which I didn't find very interesting.
But there are two characteristics of Merlin which stand-out - irritability and madness.
Irritability, cantankerousness, a short-temper... this trait has survived into almost all of the modern depictions of Merlin, and is also a feature of Gandalf and Getafix. We expect old wizards (and Geoffrey's Merlin is said to be very old, more than a century) to be easily annoyed by the questions of others.
Geoffrey's Merlin is, however, prone to full-blown insanity - and much of the plot hinges upon this. He is, indeed, driven insane by grief and regret at the end of a bloody battle - having previously been a King as well as a prophet, Merlin then flees to hide in solitude in the Caledonian Forest.
Modern Merlins and other wizards are usually eccentric rather than insane; they may be considered 'mad' by other people, but are not really so. Whereas there is no doubt that Geoffrey's Merlin was really psychotic - and his cure from insanity brings a sort of closure at the end of the poem.
According to Geoffrey; Merlin does not return to being a King, but does return to contemplative life in the forest during the milder seasons - but this time with two companions, one of whom is the legendary Welsh poet Taliessin.