No one would deny that the Republican presidential race has had more than its share of surprises and unexpected twists. But there has been a curious predictability to it as well, one that conforms closely to the expectations and preparations established months ago at the Boston headquarters of Mitt Romney’s campaign.

Long before anyone knew that a businessman named Herman Cain would, for a moment, lead the polls for the GOP nomination, or that a potentially formidable Texas Gov. Rick Perry would falter once on the national stage, Romney’s advisers surveyed the calendar of primaries and caucuses and anticipated that the race would unfold almost precisely as it has.

They may not have known which of Romney’s many rivals would become his principal opponent. On that they were no smarter than anyone else. But they understood their candidate and the political geography of the early states — the perils and opportunities. They built a strategy with the goal of putting Romney in command of the race by the beginning of this month and equipped for a potentially long fight. Which is where he is today.

Romney’s advisers knew that two of the first five states would be trouble: Iowa and South Carolina. They considered New Hampshire and Florida firewalls to protect against multiple defeats that could unravel the former Massachusetts governor’s fragile front-runner status. They saw Nevada as they see it today, an exclamation point that could give their candidate enormous advantages heading into a slow month that could starve rivals desperate for attention and victories.

Take the five early states in sequence. Iowa was a problem for Romney because its caucuses are dominated by the kind of GOP voters who are least likely to embrace him. Evangelical Christians and very conservative Republicans are not his natural constituency. Romney poured millions into the state in 2008 and was still whipped by former Arkansas governor Mike Huckabee. His advisers vowed not to repeat that mistake.

This time they handled Iowa deftly, playing down expectations through most of last year, forgoing participation in the costly and ultimately irrelevant Iowa straw poll, and hoping they might do unexpectedly well with a late push. On that they succeeded: Romney was ahead by eight votes on caucus night and surrendered that apparent victory to former senator Rick Santorum (Pa.) only when it no longer mattered.

Anticipating a loss in Iowa, Romney’s team took no chances in New Hampshire. The candidate spent a year or more securing his base there. Parsimonious with his campaign appearances in most states through much of last year, he slighted New Hampshire less than any other. He rounded up establishment leaders — elected and otherwise — and reached out as best he could to tea party activists. He was rewarded with a big victory — bigger than some expected.

South Carolina always loomed as Romney’s weakest of the early-voting states. He was something of a misfit for the electorate there: a Northerner in a Southern state, a moderate in a land of conservatives and a Mormon among evangelicals. He finished fourth there in 2008 after essentially ditching the state in the final week of campaigning. He knew a loser when he saw it.

Because of his victory in New Hampshire, he arrived in South Carolina with expectations running beyond reality. But the Palmetto State turned out to be everything Romney and his team had feared. Former House speaker Newt Gingrich tapped into an electorate angry at President Obama and caught fire.

Romney appeared out of step during the entire campaign there, bedeviled by questions about his tax returns and uncertain whether to focus on the president or Gingrich. South Carolina voters did what Romney advisers had feared, giving Gingrich an unexpectedly wide margin and leaving Republicans to wonder about the vulnerabilities of a candidate who only 10 days earlier had been called the inevitable nominee.

The question on the night of the South Carolina primary was whether it was a temporary setback, which many front-runners have experienced, or the beginning of an unraveling for the former governor. In Boston, Romney’s advisers were determined to prove that it was the former. They had been getting ready for Florida for months.

Florida wasn’t the first swing state on the calendar; Iowa and New Hampshire will both be contested in November. But the Sunshine State was the first to approximate the nation as a whole: a large, diverse, complex state with one of the highest unemployment rates and an economy battered by the housing foreclosure crisis. That made it the most important of the early-voting states.

Florida was ready-made for Romney in several ways. Its economic problems played to his background in private business. The state’s history as one of the most competitive general-election battlegrounds heightened the importance for Republican voters of finding a candidate they believed could defeat Obama. The state’s diversity meant that no single faction of the GOP could dominate the primary.

Romney had one other major advantage: a political war chest that dwarfed that of any of his rivals. But this was not accidental. It had been baked into the campaign’s calculations and preparations from the beginning.

Talk to any Republican or Democratic strategist who has run a race in Florida, and they will tell you the state sucks up money like almost no other general-election battleground. Romney poured millions into Florida and started long before all the candidates arrived after South Carolina. He spent freely on ads that savaged Gingrich. He was aided by millions more spent by Restore Our Future, a super PAC supporting his candidacy.

The months and months Romney devoted last year to raising money, the time he took going from fundraiser to fundraiser, the hours he spent on airplanes flying from one coast to another and back again in the space of a week were all designed to put him in position to run the kind of campaign in Florida that a winning candidate must run. He had money for ads and money for an organization that could turn out early and absentee voters.

If Florida was a mismatch, it was not just because Romney became aggressive or performed better than his rivals in the debates. The Florida primary was a lopsided campaign because only he had done what was necessary in advance. No wonder Gingrich was flailing in the final days before the vote.

The first four contests have highlighted many of Romney’s vulnerabilities. His favorability rating among independents has taken a beating over the past six weeks — and that is before the Obama campaign has spent any money on television ads attacking him.

His struggle to connect with voters, his sometimes awkward campaign style and his lack of rhetorical precision — on display again Wednesday with his comment on CNN that he isn’t worried about the poor because they have a social safety net — all are problems. He has a biography that could be a strength or a weakness in a general election, his profile still leaves conservatives suspicious of his motives and questions remain about his core convictions.

But exit polls from the first four contests also illustrate why many consider him the party’s best general-election candidate. He is not seen as the most conservative competitor in the race — he loses among those who say they are “very conservative” — but he may be conservative enough for most Republicans. He does well among moderate and liberal voters who participated in the GOP contests. He appears acceptable to many tea party voters, although he is not their favorite.

Looking ahead to Nevada, Romney won a majority of the vote in the caucuses there four years ago and is expected to win easily Saturday. That would give him two victories in a row and three in the first five states.

A victory would set him up for a month that includes several other favorable states, particularly Arizona and Michigan. Gingrich faces a hugely difficult challenge now, especially with Santorum and Rep. Ron Paul (Tex.) still competing.

So for all the talk about volatility, unpredictability, twists and turns and surprises, the race is just about where Romney’s team had hoped it would be. That speaks to the patience and discipline of the leaders of the operation, and the candidate’s ability to make adjustments when they are required.

Long ago, Romney’s advisers said they would run their own race, regardless of what challengers emerged. They stuck to that plan, and it has paid off.