At the beginning of the novel, both Anne and Wentworth define themselves in relation to a brighter past, and both see the time since those happy days as darker in comparison. When Wentworth turns up again, Anne is stuck in the painful position of watching her ex flirt with the Musgrove girls, while she tries to convince herself that she doesn’t want him anymore anyway. And then, even when Anne leaves Uppercross, she’s stuck in Bath, which she hates, with her family, who are obnoxious, being followed around by Mr. Elliot, whom she suspects is not what he seems.
The contrasting behavior of Anne and Louisa in Lyme causes Wentworth to start reconsidering his prejudices and to realize that listening to others’ advice isn’t all that bad (especially when that advice is not to dive headfirst into the pavement). Wentworth’s jealousy of Mr. Elliot tells Anne that he still cares about her, and that she can hope for a reunion. And Mrs. Smith’s story of how Mr. Elliot is really a Slytherin at heart ultimately makes it easier for Anne to justify her choice (version 2.0) of Wentworth to her family and friends.
Older and wiser, Anne and Wentworth manage to work things out the second time around. Just to make things extra-safe, all their rivals are paired off too. The only one of the younger generation left out is Elizabeth, who repeats the past and gets snubbed by Mr. Elliot in favor of her former bosom buddy Mrs. Clay. Hurrah for poetic justice.