In case you’ve forgotten, then-Governor Sanford disappeared from office for six days in June 2009, and his office issued a vague story about him hiking the Appalachian Trail before it was revealed that he was actually having an affair with a paramour in Argentina – on the state’s “time and dime." For this, he was slapped with 37 ethics charges and had to pay $70,000 in ethics fines, the largest amount in state history. Then, there was the messy divorce from his popular wife and the recent charge brought by his ex-wife that he had trespassed on her property.

Even Sanford appears to acknowledge the political miracle behind his congressional victory.

“I want to acknowledge a God not just of second chances but third, fourth, fifth, sixth, seventh, eighth chances, because that is the reality of our shared humanity," Sanford said at his victory celebration. “I am one imperfect man saved by God's grace.”

Here are four factors behind Sanford’s improbable comeback.

Red state, red district

Let’s not forget the obvious. South Carolina’s First Congressional District is a deep red district in a deep red state – a fact that provided the Republican candidate, no matter who, a huge leg up. Consider this: GOP presidential contender Mitt Romney won the state by almost 20 percentage points last November. And Rep. Tim Scott (R) was reelected by 27 points before he was picked by Gov. Nikki Haley (R) to fill the Senate seat vacated by Sen. Jim DeMint (R). In fact, no Democrat has held the district’s congressional seat in more than 30 years.

As Slate put it, South Carolina’s proudly Republican voters “put fidelity to party over fidelity to fidelity.”

Rule No. 1: Apologize

From the "How to Survive a Sex Scandal" handbook, Rule No. 1 is: Own up, acknowledge your flaws, and apologize. Sanford did all three from the get-go and appeared humbled from the start of his campaign, effectively vaporizing the elephant in the room.

His first TV ad addressed the issue right off the bat. Notably in this relatively religious district, Sanford adopted religious language to describe his turnaround, talking about a “God of second chances,” and mixing in religious language about forgiveness for good measure.

“I have experienced how none of us go through life without mistakes, but in their wake we can learn a lot about grace, a God of second chances, and be the better for it,” Sanford told voters in his first TV ad.

This allowed him to get out in front of the issue before his opponents could.

Even in his victory speech Tuesday night, he acknowledged his flaws, saying he had “deficiencies that were well-chronicled as a candidate.”

Nationalize the race

After he owned up to his mistakes, Sanford’s advisers masterfully moved the focus off of their candidate and onto safer territory – the Democratic Party and House minority leader Nancy Pelosi (D), persona non grata in South Carolina.

Sanford’s campaign made the race a referendum on the national Democratic Party and one of its leaders, Representative Pelosi, instead of Ms. Colbert Busch, who attempted to describe herself as an independent.

It did so with stunts – remember Sanford dragging around and debating a giant cardboard cutout of Pelosi before he was able to secure a debate with Colbert Busch? Zany, yes, but it implied Pelosi was a stand-in for Colbert Busch and connected the two indelibly in press coverage and in voters’ minds.

As Politico reported, “Every time a reporter put “Pelosi” and “Colbert Busch” in the same sentence, the Republican was winning.” Sanford also connected the two personalities through sheer repetition, mentioning Pelosi's name so many times during their April 29 debate that several people following the debate started tweeting about it.

Seasoned campaigner

Whatever Sanford’s flaws, there’s no denying that this was Colbert Busch’s first political campaign and Sanford’s sixth, by our count. And it showed.

Colbert Busch ran a tightly controlled campaign, rarely held public appearances, and sometimes appeared to be in hiding. For a newcomer and relative unknown, it wasn’t the best way to introduce oneself to voters.

Sanford, by contrast, was all charm and glad-handing. A seasoned campaigner, he wasn’t afraid to roll up his sleeves and start from scratch, riding around the Carolina Lowcountry in a black van with an aide, reintroducing himself to voters with each stop.

As Republican strategist and a former executive director of the South Carolina Republican Party, Hogan Gidley, told CNN, “Sanford may be a flawed candidate but he's a fabulous campaigner. Forget the rhetoric or the policy or the delivery – hand-to-hand, eye-to-eye, he's very good and it's impossible to outwork him.”