The idea of a fair where a bunch of different kinds of human vanities are for sale comes from John Bunyan's Christian allegory Pilgrim's Progress. (We'll pause a sec here while you check out the "What's Up with the Title?" section to catch up on that. Back? OK, moving on.)
Thackeray plays it up to the hilt. In Vanity Fair, social life – especially the hierarchical, snobby, get-ahead version of society that Becky is forever trying to conquer – revolves mainly around trying to figure out exactly what each person's particular vanity is, then giving them enough rope to hang themselves with it. Check out how Becky wins over Pitt by fixating on his diplomatic and political skills and never letting up her constant praise. Or look at how Pitt figures out that the key to disposing of James Crawley is to work on his frat-boy swagger. Conversely, we can see that James Crawley fails to secure Miss Crawley's affections (and inheritance) because he doesn't understand that, although she talks a big game of being liberal and democratic, she is actually extremely conscious of and vain about her high birth and noble station.
Those who know how to read and take advantage of the self-deceptions of others in Vanity Fair tend to do well. Those who don't fail. And every now and again the narrator will step in and bemoan the shallowness of vanity.