Here's a rather long quote from Josephine Tey (the speaker is Grant in The Singing Sands)
"It's a harmless sort of weakness," Tad said, with a tolerant lift of a shoulder.
"That is just where you are wrong. It is the utterly destructive quality. When you say vanity, you are thinking of the kind that admires itself in the mirror and buys things to deck itself out in. But that is merely personal conceit. Real vanity is something quite different. A matter not of person but of personality. Vanity says, "I must have this because I am me." It is a frightening thing because it is incurable. You can never convince Vanity that anyone else is of the slightest importance; he just doesn't understand what you are talking about. He will kill a person rather than be put to the inconvenience of doing a six month stretch."
"But that's being insane."
"Not according to Vanity's reckoning. And certainly not in the medical sense. It is merely Vanity being logical. It is, as I said, a frightening trait, and the basis of all criminal personality. Criminals--true criminals, as opposed to the little man who cooks the accounts in an emergency or the man who kills his wife when he finds her in bed with a stranger--true criminals vary in looks and tastes and intelligence and method as widely as the rest of the world does, but they have one invariable characteristic, their pathological vanity."
I'm thinking about M. Scott Peck, in People of the Lie, arguing that all of what we call evil is rooted in narcissism, and of Patricia Highsmith's Ripley character who is perfectly charming except he needs to bump off whomever gets into his way.
And I'm considering widening Tey's analysis to include even those we don't usually label criminals but just dishonest, such as liars and all kinds of cheats.
Of course there are degrees of vanity. Still, observing people from this angle might serve to warn us about those we ought to keep our distance from. And no doubt it would help us write real and convincing bad guys.