Dumbledore, over and over, is demonstrated to be a man who can see through people with all the power of an x-ray machine. Nothing escapes him, there is no fooling him. He knows.
So how the heck did Lockhart get in??
Although he's definitely a man with wisdom and experience, it's easy to get an impression of Dumbledore far beyond his actual abilities. This is partly because we spend the majority of the novels hearing about him from a child who hero-worships him, supported by the likes of Hagrid and McGonagall (the former another hero-worshipper, the latter a loyal member of his power base who speaks to reassure a child). We also get the impression that the wider wizarding world reveres him or fears him or both.
In the politically loaded circles he moves in, Dumbledore's reputation is one of his greatest assets and we see him working hard to maintain an enigmatic aloofness that encourages such readings; even his first words ("Nitwit! Blubber! Oddment! Tweak!") are calculated to make his students unsure exactly how competent he might be. A man who is comfortable seeming so foolish while holding so much power must be even more powerful than we know--right?
Regardless of how much the rest of the Wizarding World believes these things about Dumbledore, Harry believes that his surrogate father figure is absolutely competent. His companions --schoolchildren and patronizing teachers-- enforce this belief. Because Harry's narrative is our primary window into the Wizarding World, it is easy to trust Harry's word on these things.
The events of the novels, however, repeatedly show that this belief is woefully inaccurate. Dumbledore's mis-handling of Harry in the later novels, the Mad-Eye Barty Fiasco, Quirrell... however experienced, powerful, and wise, the Headmaster's got a record of dropping the ball. This extends far into the past, from not understanding the ambitions of his own boyhood companion, and later the young Riddle, and it continues right up to the disappointment of the locket he sacrificed so much to obtain.
Voldemort jinxed the DADA position in the 1950s. Since then no one has been able to hold the position for more than a year. By the early '90s Dumbledore must have had slim pickings to choose from --just look at who he would choose in later years!
Given that many of the DADA professors probably met unpleasant or gruesome ends, the Headmaster may have also been trying not to eradicate the best and brightest of the Wizarding World's hopes to stand up against the Dark Lord when he returned. I can't really see Lockhart as Auror or Order material, can you? Maybe Dumbledore couldn't either.
Building on the previous two points: Of all Dumbledore's goofs, Lockhart is probably the least dangerous. Lockhart knew enough about Defense Against the Dark Arts to at least fool people into thinking he was good at it: since he actually interviewed and appropriate the stories of real DADA experts, he was at least passingly familiar with the concepts involved.
After the Pixie Incident, Lockhart demonstrated self-awareness and the ability to learn by only having the students study his own books for the rest of the term. Although egotistical and deathly boring, it did expose them to the (admittedly adulterated) stories of genuine DADA exploits. And Lockhart didn't endanger the students half so regularly as Hagrid's classes, or Quidditch.
I also suspect pressure from the regents and/or the Ministry, although this is purely speculative. Given the power struggle between Fudge and Dumbledore which comes to a head with the execution-by-Dementor at the end of Book Four, and the connections between the Ministry and the Regents (visible via Lucius Malfoy), I think Fudge and Malfoy conspired to saddle Dumbledore with an incompetent. It was easily enough disguised as a publicity stunt to boost the school's reputation following the previous years' troubles (a rampaging troll alone would probably make many parents re-consider their children's educational opportunities).
So if you prefer to think of Dumbledore as supremely competent, then --considering Lockhart's apparently harmless nature-- Dumbledore might have considered his employment a reasonable sacrifice to avoid prematurely butting heads with the other power players in Wizarding politics.
Pottermore has the following to say about Lockhart's appointment:
Albus Dumbledore, the Headmaster during Lockhart's time, happened to have known two of the wizards whose memories Lockhart erased, and had a shrewd and accurate idea what was happening. He correctly believed that dragging Lockhart into a normal, school atmosphere would reveal his fradulence and, a vacancy in Defence Against the Dark Arts having opened up in June 1992, tracked down the author and, .... convinced Lockhart to return to Hogwarts (something Lockhart had not been too keen to do, as many of his teachers were still there and might have remembered his foolishness and ineptitude).
Even the book canon, namely the Chamber of Secrets implicitly supports the view that Dumbledore always had known or guessed the full truth about Lockhart. After Harry's explanation of the ordeal in the Chamber, he asks:
“But one of us seems to be keeping mightily quiet about his part in this dangerous adventure,” Dumbledore added. “Why so modest, Gilderoy?”
And on hearing Ron's answer that
“He tried to do a Memory Charm and the wand backfired,”
he does the following:
“Dear me,” said Dumbledore, shaking his head, his long silver mustache quivering. “Impaled upon your own sword, Gilderoy!”
It cannot be more clear that Dumbledore really intended the pun on the last words, referring to Lockhart's masterpiece Memory Charms on others, and that he took the predicament as fitting enough.
I suppose it can be reasonably assumed that Harry recognised this full knowledge of Dumbledore as well, for he never explains a word to him. He may have thought to spare Lockhart's image from the public, but Dumbledore is not a man he would have done that with, given Harry's unusual grasp of strategic issues in every situation. In Order of the Phoenix, he lets Dumbledore know that "he was the snake", for example, something he found hard to contemplate himself, even in front of Sirius. There is nothing here that would have prevented him from that. Ron's wand "being in a condition to backfire" is not something which Ron can be implicated for, any more, and even much less, than the opening of the Chamber is for Ginny.
From the books, I recall that people were starting to think that the DADA job was cursed and Dumbledore seemed to be having trouble filling the position.
He even went as far as hiring Prof. Lupin which was a somewhat dangerous and controversial choice.
In my opinion, Lupin was a more desperate choice than a charlatan like Lockhart.
I'm speculating but again, I think this means that the position was hard to fill. Such as, nobody wanted it so he gave it to Lockhart and Lupin.
Dumbledore was also very perceptive, he must have known something was amiss with Lockhart, but Dumbledore believes in people and decided to give him a chance (as he gave Lupin a chance despite the danger)
And perhaps Dumbledore figured that over time Lockhart would grow into the job (on the job learning.)
So I personally think that every defence against the dark arts teacher Dumbledore hires serves as a lesson in why you shouldn’t think people are exactly what they appear to be or some similar lesson in why you shouldn’t always trust and obey figures of authority/ why you should despite your misgivings toward them.
Quirrel literally hid his connection to Voldemort in plain sight, posing as a nervous and harmless individual with literal evil being covered up at all times. He serves as a really on the nose symbol of why you should not underestimate someone who appears overtly fearful and benign, for it could easily be a trick, which in this case it is.
Lockhart is something of a polar opposite to Quirrel, an over confident man posing as a great hero who secretly is a deceitful coward. Between Quirrel and Lockhart Dumbledore has demonstrated very well why you should never take a persons overt persona for granted, that there can always be something very untrustworthy about someone who appears to go out of their way to be trusted, whether it is posing as a hero or pretending to be a coward.
Lupin then represents the polar opposite lesson: don’t write someone off as incapable of being a great role model or not having undergone great suffering in their lives which you could learn from. Lupin of course is also hiding the fact that he is a werewolf, though in this case it is not because he has malign intentions, but rather the opposite. In many ways Lupin’s big reveal is sort of a trick played on the reader as we’d all expected him to have some dark secret the same way the previous two had. Of course at first we believe this to be true when it turns out that Sirius Black is his best friend, but of course that turns out to be a false flag as well. Lupin serves as a lesson to not jump to conclusions based on someone’s odd and sometimes elusive behaviour, a lot of the time they’re not hiding anything that is malicious and they truly mean the best.
I think the most complex lesson is Mad Eye Moody. I think he is the most obvious ‘don’t judge a book by its cover’ lesson of all. But it’s also much more complicated than that. Mad eye represents a kind of irreverent will to lead impressionable people to be irresponsible in my opinion, Barty Crouch pretends to be the well known auror Moody who’s a veteran of fighting dark forces for the greater good. He uses this guise to influence the young and easily influenced students to take the line that divides the dark and the light less seriously with lessons that teach forbidden curses and appearing to mentor Harry so as to lead him astray and eventually allow Harry to be used in order to bring back Voldemort fully. In many ways Moody/Crouch serves as a lesson to not be so easily led astray by someone who would influence you to break rules that are there for your own good. Which before now in the Harry Potter books was certainly not in keeping with the theme of ‘break the rules and save the day!’ Which was the running theme in the first three books and essentially the entire series.
Umbridge then serves as an example quite as to why there are rules we should break. Whereas before the rules were broken by Harry Ron and Hermione because they had found out about conspiracies to threaten their lives and their school, Umbridge serves as a blatant example of how and why rules that need to be broken are made, and just how much rules can be made without the interest of the greater good, but rather the interest of total control. Whereas before now the DADA teachers had been lessons in what kind of person you shouldn’t judge by the cover or immediately accept at face value, Umbridge serves as a lesson in why authority altogether isn’t always intent on the greater good. In many ways every book’s lesson is on how and why you should always think for yourself to some extent, but the order of the Phoenix really drives this lesson home with Umbridge, because in theory she is meant to represent a benevolent authority where she actually isn’t even evil because she serves a dark lord in secret, she actually just serves her own twisted sense of self righteousness. Her ethos is even more self centred and petty than Voldemort’s in many ways, and even Rowling herself said that she reckons Umbridge is more evil than Voldemort.
Snape: do I even need to explain? The ultimate example of why you really cannot judge a book by its cover, the lesson which he serves to demonstrate is covered in depth in the books and I shall not bother to give my take on it when enough material already exists for everyone to make an informed interpretation on him themselves.
Going back to the subject of Gilderoy Lockhart, he is but one part of a series of examples which I believe Dumbledore chooses both as somewhat adequate DADA teachers, but also lessons in themselves and Lockhart more specifically serves as a strong example of what not to be, obsessed with fame and fortune instead of valuing the very thing he pretends to represent, Lockhart is a lesson to not be vain and deceitful.