Clinton hinged her whole campaign on an early knockout blow on Super Tuesday, while Obama's staff researched congressional districts in states with primaries that were months away. What they found were opportunities to win delegates, even in states they would eventually lose.
Obama's campaign mastered some of the most arcane rules in politics, and then used them to foil a front-runner who seemed to have every advantage money, fame and a husband who had essentially run the Democratic Party for eight years as president.
"Without a doubt, their understanding of the nominating process was one of the keys to their success," said Tad Devine, a Democratic strategist not aligned with either candidate. "They understood the nuances of it and approached it at a strategic level that the Clinton campaign did not."
Careful planning is one reason why Obama is emerging as the nominee as the Democratic Party prepares for its final three primaries, Puerto Rico on Sunday and Montana and South Dakota on Tuesday. Attributing his success only to soaring speeches and prodigious fundraising ignores a critical part of contest.
Obama used the Democrats' system of awarding delegates to limit his losses in states won by Clinton while maximizing gains in states he carried. Clinton, meanwhile, conserved her resources by essentially conceding states that favored Obama, including many states that held caucuses instead of primaries.
In a stark example, Obama's victory in Kansas wiped out the gains made by Clinton for winning New Jersey, even though New Jersey had three times as many delegates at stake. Obama did it by winning big in Kansas while keeping the vote relatively close in New Jersey.
The research effort was headed by Jeffrey Berman, Obama's press-shy national director of delegate operations. Berman, who also tracked delegates in former Rep. Dick Gephardt's presidential bids, spent the better part of 2007 analyzing delegate opportunities for Obama.
"The whole Clinton campaign thought this would be like previous campaigns, a battle of momentum," said Thomas Mann, a senior fellow at the Brookings Institution, a Washington think tank. "They thought she would be the only one would who could compete in such a momentous event as Super Tuesday."
Instead, Obama won a majority of the 23 Super Tuesday contests on Feb. 5 and then spent the following two weeks racking up 11 straight victories, building an insurmountable lead among delegates won in primaries and caucuses.
What made it especially hard for Clinton to catch up was that Obama understood and took advantage of a nominating system that emerged from the 1970s and '80s, when the party struggled to find a balance between party insiders and its rank-and-file voters.
Until the 1970s, the nominating process was controlled by party leaders, with ordinary citizens having little say. There were primaries and caucuses, but the delegates were often chosen behind closed doors, sometimes a full year before the national convention. That culminated in a 1968 national convention that didn't reflect the diversity of the party racially or ideologically.
The fiasco of the 1968 convention in Chicago, where police battled anti-war protesters in the streets, led to calls for a more inclusive process.
One big change was awarding delegates proportionally, meaning you can finish second or third in a primary and still win delegates to the party's national convention. As long candidates get at least 15 percent of the vote, they are eligible for delegates.
The system enables strong second-place candidates to stay competitive and extend the race as long as they don't run out of campaign money.
"For people who want a campaign to end quickly, proportional allocation is a bad system," Devine said. "For people who want a system that is fair and reflective of the voters, it's a much better system."
Another big change was the introduction of superdelegates, the party and elected officials who automatically attend the convention and can vote for whomever they choose regardless of what happens in the primaries and caucuses.
Superdelegates were first seated at the 1984 convention. Much has been made of them this year because neither Obama nor Clinton can reach the number of delegates needed to secure the nomination without their support.
A more subtle change was the distribution of delegates within each state. As part of the proportional system, Democrats award delegates based on statewide vote totals as well as results in individual congressional districts. The delegates, however, are not distributed evenly within a state, like they are in the Republican system.
Under Democratic rules, congressional districts with a history of strong support for Democratic candidates are rewarded with more delegates than districts that are more Republican. Some districts packed with Democratic voters can have as many as eight or nine delegates up for grabs, while more Republican districts in the same state have three or four.
The system is designed to benefit candidates who do well among loyal Democratic constituencies, and none is more loyal than black voters. Obama, who would be the first black candidate nominated by a major political party, has been winning 80 percent to 90 percent of the black vote in most primaries, according to exit polls.
"Black districts always have a large number of delegates because they are the highest performers for the Democratic Party," said Elaine Kamarck, a Harvard University professor who is writing a book about the Democratic nominating process.
"Once you had a black candidate you knew that he would be winning large numbers of delegates because of this phenomenon," said Kamarck, who is also a superdelegate supporting Clinton.
In states like Ohio and Pennsylvania, Clinton won the statewide vote but Obama won enough delegates to limit her gains. In states Obama carried, like Georgia and Virginia, he maximized the number of delegates he won.
"The Obama campaign was very good at targeting districts in areas where they could do well," said former DNC Chairman Don Fowler, a Clinton superdelegate from South Carolina. "They were very conscious and aware of these nuances."
But, Fowler noted, the best strategy in the world would have been useless without the right candidate.
"If that same strategy and that same effort had been used with a different candidate, a less charismatic candidate, a less attractive candidate, it wouldn't have worked," Fowler said. "The reason they look so good is because Obama was so good."