Ted Cruz won the Iowa caucuses by winning a few key demographics (The Washington Post)

It was on a hot July day in 2013, six months after he joined the Senate, that Ted Cruz began what would become his winning campaign in Iowa.

At a faith gathering at the Des Moines Marriott, the Texan bowed his head as pastors laid their hands on his shoulders to pray. Meanwhile, the senator’s aides collected their names and email addresses, starting a database of evangelical leaders that would swell over the following months and years. Cruz’s father, Rafael, himself a preacher, looked on, beaming.

Donald Trump began his Iowa campaign with a business trip. He landed here in January 2015 to address a land investment expo, but, unbeknownst to the political world, he also started to build his campaign.

Iowa was a foreign place to the Manhattan mogul, and Trump knew he needed two things: credibility and a fast tutorial. He sought to gain both through Chuck Laudner, a veteran Iowa operative.

Trump invited Laudner and his wife, Stephanie, into his SUV. He poured on the charm. He leaned in to listen as Laudner explained Iowa’s political topography — the 99 counties, the caucus math, the glut of disengaged Iowans who might be persuaded to come out for the right candidate.

Iowa Caucus entrance poll results

Trump later brought the couple aboard his Boeing 757, where they sat in plush leather chairs with gold-plated seat-belt buckles and sipped soft drinks. Trump tried to make a deal — and Laudner was sold. The Trump candidacy would soon be born, and the businessman would try to win over Iowa just as he had won over Laudner: by the power of his own seduction.

There was yet a third playbook: that of Marco Rubio. The senator from Florida banked on rising late. His supporters grumbled that he showed disdain for the campaign grind; during a five-day Iowa swing in November, he took the third day off to watch football.

But Rubio believed that Iowa could be won with an air war and a late burst of activity. In the final three weeks, his ads were ubiquitous on televisions here. As he crossed the state last weekend sounding an optimistic call for Republican unity, his campaign paid to beam a 30-minute video of him on the stump into homes in each of Iowa’s media markets.

Rubio’s strategy proved highly effective as he surged to a surprisingly strong third place, just one percentage point behind Trump.

But in a state that has long rewarded conservatives who put religion at the fore, and in a political era dictated by data analytics, Cruz won on the strength of both. His message was perfectly tuned to Iowa conservatives, he used his web of relationships to try to unite evangelical leaders, and he invested deeply in data and turnout organization. By caucus day, Cruz had 11,986 volunteers in Iowa and trained captains at nearly all of the 1,681 precincts.

“We formed the philosophy that our campaign would be waged by neighbors telling their neighbors who to vote for, and we needed to set up every piece and shred of data to allow that to happen,” said Jeff Roe, Cruz’s campaign manager.

That approach was paying off by the beginning of the year. Cruz had a clear lead in the polls. His list of endorsements was growing by the day. Crowds were swelling, even when he stopped by gas stations near midnight.

On a six-day, 28-stop bus tour in early January through far-flung pockets of Iowa, Cruz sounded triumphant. “Father God, please, keep this awakening going,” he said in Mason City.

Still, two threats started to emerge.

Rubio’s “peak late” strategy was ramping up, and he started to directly engage Cruz with a new fervor. He also began talking about his faith everywhere he went.

Rubio had a model in Sen. Joni Ernst (R-Iowa), who has found support from both the right and the center of Iowa’s GOP going back to 2014, when she navigated a crowded primary in spite of her ties to the party establishment. Rubio was guided by Ernst’s strategist, Todd Harris, who recognized that suburban Republicans could compete with the state’s conservative wing.

“We went fishing where the fishes are,” Harris said. “We knew exactly who the voters we wanted to talk to were. A lot of them were suburban. It’s no surprise [Rubio] was dubbed the ‘mayor of Ankeny.’ People made a lot of fun at that, but we knew what we were doing.”

Then there was Trump. Around the beginning of the year, his gut was telling him he could be the winner. He started to attack hard, hitting Cruz on his Canadian birth, on previously undisclosed loans, on his “nasty” reputation in Washington.

“I am putting myself a little bit out there,” Trump said in an interview in the boys’ locker room at Muscatine High School, where he held a rally late last month. “If I come in second, I come in second. I think we’re going to come in first, frankly. I could say, ‘Oh, well, I just want to do well . . .’ ”

Trump rolled his eyes. “I want to win,” he said. “I want to win.”

The Trump way

Hours after Trump’s June 16 announcement that he was running, he flew to Des Moines for his first rally. Attendees at the Hoyt Sherman auditorium were revved up. The reigning Miss Iowa was there. Cub Scouts recited the Pledge of Allegiance. With Neil Young’s “Keep On Rocking in the Free World” blaring, Trump was surrounded as he slowly made his way down the aisle.

As he left the rally, Trump asked campaign manager Corey Lewandowski, “Why aren’t we going to win this state?”

Trump’s on-again, off-again romance with Iowa had begun. He would spar with the state’s biggest newspaper, the Des Moines Register, and bar its reporters from his events. When Ben Carson briefly surpassed him in the polls in the fall, he took to the stage in Fort Dodge and wondered resentfully, “How stupid are the people of Iowa?”

But Trump always believed he could will himself to victory here. Early on, Laudner, director of Trump’s Iowa campaign, described the strategy in the state as a “parallel campaign.” Rather than focusing on the roughly 120,000 Republicans who regularly caucus, he targeted nontraditional voters — “people who wouldn’t be caught dead at a Republican event.”

That included Trump’s lieutenants. Tana Goertz, a political neophyte best known for being a runner-up on Trump’s NBC show “The Apprentice,” was tapped as Iowa co-chair. She used her own celebrity as a former spokeswoman for the Bedazzler, a rhinestone-setting machine popular with home-crafts enthusiasts, to draw in volunteers.

One brisk night last week, Goertz was at Trump’s Iowa headquarters carrying a carton of beads and shiny plastic gems as she headed out to a call center. She rewarded the most dedicated volunteers by Bedazzling their “Make America Great Again” T-shirts and hats.

Goertz also recorded a cheery YouTube video with instructions on how to caucus. It was viewed more than 200,000 times.

During the summer, as Trump whipped up throngs of fans from Alabama to Arizona, aides drove a hulking royal-blue bus around Iowa, wowing locals and signing up potential supporters.

By late August, Trump had surged to the lead for the first time in the Register’s Iowa poll.

But he had difficulty sustaining his momentum. Enthusiasm for Carson was growing. Trump’s flippant comment at an August gathering of evangelicals that he occasionally had a “little cracker” when he attended church and rarely, if ever, asked God for forgiveness sowed doubts about his character.

His operation now had a dozen staffers in Iowa, but his organizing was shrouded in mystery. Republican operatives became dubious and saw little evidence of a Trump ground game.

While other campaigns happily showcased packed phone banks and detailed complex data applications, Trump’s did neither. After years of being a favorite source of quotations for Iowa reporters, Laudner went, in his words, “radio silent.”

Cruz sows the fields

From his first trip to Iowa three summers ago, Cruz was plotting his path to the caucuses.

Cruz’s father, Rafael, journeyed to every corner of the state, again and again, huddling with pastors and preaching in churches. He told the story of his emigration from Cuba and testified to Ted’s character, conviction and conservatism.

To run his Iowa campaign, Cruz interviewed several seasoned consultants but settled on a former Baptist pastor named Bryan English who had deep ties to the evangelical networks led by Rep. Steve King and Bob Vander Plaats, head of the conservative group the Family Leader. English was an unusual hire, but the move underscored Cruz’s strategy.

“Do you set up your operation with a bunch of khaki-slacks, blue-blazer clowns?” Roe, Cruz’s campaign manager, asked. “Or do you set it up with an activist?”

Back at national headquarters in Houston, Roe and his team invested several million dollars in a data analytics operation. There were about 175,000 Republicans in Iowa who had participated in a presidential caucus, and Cruz’s statisticians and behavioral psychologists set out to learn everything they could about them.

The campaign conducted “psychological targeting” of likely caucus-goers, building its own version of a Myers-Briggs personality test to categorize Republicans so it could send them personally tailored phone calls, mail and other messages.

Sitting in his office last week, with war-strategy tomes by Sun Tzu and Carl von Clausewitz stacked on his desk, English looked out at the bustling phone bank, which on this afternoon included Rafael Cruz.

“If anybody goes to caucus and says, ‘I haven’t seen Ted Cruz,’ I want it to be their fault, not ours,” English said.

For the first six months of the campaign, he was the lone Cruz staffer in Iowa, and he worked out of the basement of his home. By August, though, there was a headquarters in Urbandale, then more staffers. The team grew to 20, and Cruz rented out a dormitory building in Des Moines — “Camp Cruz” — to house volunteers from Texas and other places who came in the final month to help canvass.

Cruz peeled supporters from former senator Rick Santorum of Pennsylvania and former Arkansas governor Mike Huckabee, who together won the past two caucuses with heavy support from evangelicals and home-school parents. Cruz also targeted the libertarian followers of former congressman Ron Paul, whose son, Sen. Rand Paul (R-Ky.), was proving to be less popular than his father in his presidential bid.

By January, the Cruz campaign had so much information about Iowa Republicans that it believed it could pinpoint exactly which ones were certain to caucus for Cruz, which were undecided and which were leaning toward competitors.

Ten days before the caucuses, the internal data (based on a turnout of 150,000 people, which would set a new record) showed that 19,186 were certain to be with Cruz. About 1,400 had supported him at one point but had turned to another candidate; they got personal phone calls from Ted; his wife, Heidi; or Rafael Cruz in a push to win them back.

Only 15,626 people were certain to caucus for Trump, according to the figures. The Cruz campaign believed it was winning.

The scramble for Iowa

The decision facing Trump was straightforward: shower attention on Iowa in the final days, only to risk a humbling defeat, or turn to New Hampshire and South Carolina, the next two states to vote, where he enjoyed substantial leads.

The real estate magnate chose to roll the dice, propelled, in part, by his irritation at watching television pundits say that Cruz was likely to win.

So Trump reminded Iowans, again and again, about Cruz’s opposition to federal renewable-fuel standards, an issue critical to the state’s powerful ethanol industry. In that, Trump had an ally in Gov. Terry Branstad (R), who broke his neutrality to call for Cruz’s defeat.

Trump also raised questions about Cruz’s Canadian birth, first in an interview with The Washington Post and then at almost every rally and on TV. The issue dogged Cruz: A man dressed in a Royal Canadian Mounted Police uniform trailed him, and a super PAC supporting Rubio ran an ad depicting Cruz’s face inside Canada’s iconic maple leaf. Huckabee’s super PAC aired a provocative ad suggesting that Cruz was “a millionaire that brags about his faith” but does not tithe.

There were signs that the right was not united behind Cruz. Former vice-presidential nominee Sarah Palin, a tea party and evangelical heroine, endorsed Trump at a splashy rally in Ames.

The nightly surveys conducted by the Cruz campaign showed that Palin was a boon for Trump — 67 percent of Iowa Republicans had heard of her endorsement, and of them, 19 percent were more likely to support Trump. Only 13 percent were less likely to.

A few days later, Trump won the backing of Jerry Falwell Jr., son of the late televangelist and president of Liberty University. The two men campaigned together across Iowa the weekend before the caucuses.

Rubio also was making an overt play for evangelical support, airing ads about his faith and opposition to abortion, and talking on the stump about God as if he were a Sunday school teacher.

Not everyone was sure that Rubio’s embrace of the religious right would work; some thought he was going too far in his attempt to win Iowa. “Rubio’s mistake is that he’s moved too far toward the Christian right when he should be focused on the mainstream,” Doug Gross, an unaffiliated Iowa Republican power broker, said in December.

Attendees at Rubio’s events often would say that they were drawn to him not out of passion but out of a desire to back someone more moderate who had a chance to win in the general election.

At a Rubio stop in the late fall in West Des Moines, Carol and Pete Click said they drove through an icy mush and argued politely along the way about the senator from Florida. Pete, 65, a retired business owner, said he wasn’t enthusiastic, but Carol urged her husband to give Rubio a second look.

“All right, I’m open to it,” Pete told his wife. “I’m tired of the establishment, but Trump is a problem and maybe he needs to be stopped here.”

Carol replied with a chuckle. “We’ve never caucused” for someone with a chance of winning the general election. “It’s about time.”

In the past two weeks, Rubio shifted as he saw an opening with Cruz and Trump bloodying each other. He kept up his citation of Bible passages and channeled voter anger, but began to speak more of his ability to bring the party together as others clashed. He was a bridge-builder with conservative credentials.

It worked. Entrance polls of caucus-goers showed that he won over voters in Iowa who waited until the final week to choose a candidate.

On the eve of the caucuses, Cruz returned to Des Moines for a Sunday evening rally at the state fairgrounds.

The crowd was deeply religious, with children wearing church youth-group T-shirts and two elderly couples up front holding hands in prayer. The videos that played on oversize screens before Cruz went on featured soaring guitar chords mixed with testimonials from conservative leaders. Rep. Steve King rallied the crowd with an introduction that assured people Cruz was spoon-fed the Constitution and the Bible as a child.

Cruz cast himself as the one true conservative in the race. “Stand with us. Caucus for us. If we stand together, we will win.”

The crowd roared. A day later, they stood with him.