How do you survive a sex scandal?

Public-relations reps and crisis-communications counselors have made careers of dispensing advice on such matters. And so the usual counsel follows a fairly trite and untested path: Be honest from the start. Apologize. Make sure your wife stands behind you.

Hogwash, for the most part. Everyone apologizes, nearly everyone’s wife is supportive, and no one is honest from the start. But still some politicians survive sordid situations, and some do not.

Why?

Let’s allow history to be our guide. There are more than enough examples to choose from. It was only Tuesday that former South Carolina governor Mark Sanford, whose career was believed to be over when he fled to Argentina to be with a woman who was not his wife (and not, as he said, out hiking the Appalachian Trail), was standing on stage after he’d just won the GOP nomination for a congressional seat, his onetime mistress beaming at his side.

Looking at some of the biggest sex scandals of the last decade or so, we have tried to parse the factors that allow some pols to skate by and others to live out their days as little more than punchlines. Consider the following guidelines, then, a free, nonexpert, historically grounded What It Takes to keep your name out of the mud. A study, if you will, in what separates the Sanfords from the Weiners.

Rule #1: Don’t Be From New York

If there is one thing that a look back at recent sex scandals reveals, it’s that it is nearly impossible to survive one if you hail from the Big Apple. Louisiana Sen. David Vitter survived seeing his phone number turn up in the phone records of the D.C. Madam; Gov. Eliot Spitzer went down within days after it was discovered that he had been in contact with the Manhattan version. Anthony Weiner didn’t even have any actual sex and he was forced to resign. Vito Fossella was a popular longtime congressman from Staten Island, the scion of a well-connected political family, but he couldn’t survive the news that he had a daughter with a Virginia woman. Compare Fossella’s folly with that of his colleague, Dan Burton of Indiana: he admitted to fathering a child out of wedlock in 1998, and was elected to seven more terms in the House before retiring last year.

What makes New York so unforgiving? It’s not its citizenry, which seems otherwise pretty comfortable with carnality. (Any other metro areas feature a naked cowboy as a mascot?) But Gotham’s concentration of media is so intense that it makes it harder for embarrassments to quietly disappear. When Weiner announced he was stepping down, it wasn’t just the local political press that was there—outlets from Europe and Japan had their New York correspondents there as well. And so even though some fans may be desperate for a Spitzer comeback, the regular presence of a black-sock icon on the front page of the Daily News and the Post is likely to keep the former Wall Street cop in his current job as a TV commentator.

Rule # 2: Hetero Hanky-Panky Only

We hate to say it, but even in this era of increasing acceptance of homosexuality, the public seems to have little tolerance for anything other than straight males hooking up with straight females. Bill Clinton could have a relationship with an intern and still be greeted as an éminence grise years later. But Mark Foley sends suggestive emails to male House pages and he resigns in disgrace. Eric Massa tickles his male staffers and he too is never heard from him again. No one could figure out why New York Rep. Chris Lee resigned immediately after shirtless photos of him soliciting dates on Craigslist appeared. But it a made a bit more sense after it was revealed that he was actually searching for transgender women. As tawdry as Larry Craig’s airport-bathroom hookup was, it seems hard to believe that he would have retired had he made similar advances to a lady. And for what it’s worth, out-and-proud gay politicians seem to survive sex scandals OK; Jim Kolbe got through the same congressional page fracas that ensnared Foley, and Barney Frank remained a beloved figure despite admitting a relationship with a male hooker.

Rule # 3: Incidents in the Past Tend to Stay in the Past

For those who shake their head at the American public’s apparent prudishness, it is worth noting that we are actually a pretty forgiving bunch. No one is really keeping a moral scorecard, tallying up the sex scandals and rendering a judgment. It is only when pols get busted in the moment that the pressure grows too great. Thus, Vitter can survive, because he hadn’t visited the D.C. Madam’s den of inequity for several years. Likewise, Newt Gingrich can be a legitimate presidential candidate in 2012 because his affair came to light years after it began. Rabid social conservative Henry Hyde survived accusations of hypocrisy and stayed in office for another decade after it was discovered that he once had an affair, mainly because the incident was three decades in the past. The list goes on and on, but it explains why politicians go to such inordinate lengths—think John Edwards hiding from National Enquirer photographers in a stairwell—to avoid getting caught. Cradle a newborn love child and you are through; send that same child off to kindergarten and you live to see another day.

Rule #4: Make Sure People Like You

Bill Clinton was the lovable rapscallion. Ted Kennedy was American royalty. Antonio Villaraigosa will be remembered as the charismatic path-breaking first Latino mayor of Los Angeles, not as the guy who cheated on his wife with a TV reporter. On the other hand, Eliot Spitzer was a moral scold whose steamrolling manner was angering even his allies. John Edwards was viewed as too slick by half, his beachfront mansion belying his stated position as a champion of the downtrodden. Even his fellow Democrats seemed to tire of Anthony Weiner’s televised histrionics. The lesson is obvious, and as old as politics: the more people like you, the better off you will be.