The most important lesson of Mark Sanford's victory Tuesday night is: Don't have a sex scandal in a swing district. The combination of Sanford's sex scandal and his opponent's relationship to a funny person was not enough to overcome the fact that South Carolina's first congressional district is very Republican. It's not that Sanford wasn't punished for getting caught flying to Argentina to have an affair, The New York Times's Nate Silver explains. Because Mitt Romney won the district by 18 percentage points just a few months ago, while President Obama was reelected by about 4 points, the district is about 22 points more Republican than the country. That means Sanford won by about 13 points less than you would expect for a Republican candidate, Silver writes. That's perfectly average for a sex scandal. A 2011 St. Edward's University paper finds that such scandals typically cost politicians 6.5 percentage points of their vote. If one candidate's drop in support is his opponent's gain, that adds up to 13 points.

So Anthony Weiner and other scandalous politicians should look to Sanford for tips in geography, not in public relations. If Weiner wants to win in New York City, he needs to run against a right-winger, no matter how well he thinks his own public-apology tour is going. Indeed, Sanford did not actually handle his redemption very well. When news broke that he was charged with trespassing on his wife's property, he changed his story about why he did it. He took out a full-page ad in the Charleston newspaper warning that "There are two sides to every story" — implying that his wife might share some blame for his transgressions. The first time his son met his mistress-turned-fiancée was at his primary victory party. But he was a Republican in a Republican place, and, as Politico's Alex Isenstadt reports, was smart enough to turn Elizabeth Colbert Busch into Nancy Pelosi.

The same goes for, say, former Massachusetts Rep. Barney Frank. It's not that Frank got in front of the scandal that his partner ran an escort service out of his basement. It's that Frank was a Democrat in Massachusetts. This means the best places to have sex scandals are the most red or blue states. For statewide Democrats, according to Gallup, that's Hawaii, Maryland, Rhode Island, New York, and Massachusetts. For statewide Republicans, that's Utah, Wyoming, Idaho, North Dakota, and Nebraska. 

Sanford's victory speech perfectly captured the party-trumps-sex phenomenon: "I am one imperfect man saved by God's grace, but one who has a conviction on the importance of doing something about spending in Washington, D.C."