Lockhart is the series' resident fool. And a pompous fool at that. Five times winner of Witch Weekley's most charming smile award, he takes credit for the deeds of others, is profoundly inexpert with his wand, and performs only memory charms with any skill. He is the only teacher that makes Snape likeable by comparison. Maybe.
Anyway, he is Harry's Defence Against the Dark Arts teacher for a year, and his lessons consist of reenactments of some of the more lurid bits of his books. All in all, he is incredibly stupid, but knows this, and is therefore smart. Ahem. Ahem indeed.
Anyway, at the end of the Second Book his memory charm backfires on himself, and he loses all his memory. He leaves then. Pity, though, as he is responsible for some of the more humorous sections of Book 2. Like, for instance, his idea of a duelling club, and his Valentine's Day surprise. He really is quite a ridiculous character, and while he isn't exactly likeable, he still is funny.