Both of the elections involved incumbent presidents with approval ratings hovering around or just under 50 percent facing challengers who were rich men from Massachusetts (though one made his money and the other married it).
In both cases, the challenger and his campaign seemed confident he was going to win -- and had reasonable grounds to believe so.
In both elections, the incumbent started running a barrage of negative ads defining the challenger in the spring. And in both elections, the incumbent had at least one spotty debate performance.
In both elections, each candidate concentrated on a more or less fixed list of target states, and in both elections the challenger depended heavily on outside groups' spending that failed to achieve optimal results.
The popular vote margins were similar -- 51 to 48 percent for George W. Bush in 2004, 51 to 47 percent for Barack Obama in 2012.
The one enormous difference was turnout. Turnout between the 2000 and 2004 elections rose from 105 million to 122 million -- plus 16 percent. Turnout between the 2008 and 2012 elections fell from 131 million to 128 million -- minus 2 percent.
Turnout is a measure of organization but also of spontaneous enthusiasm.
In 2004, John Kerry got 16 percent more popular votes than Al Gore had four years before. But he lost because George W. Bush got 23 percent more popular votes than he had four years before.
Kerry voters were motivated more by negative feelings for Bush than by positive feelings for their candidate. They disagreed with Bush's major policies and disliked him personally. The Texas twang, the swagger, the garbled sentence structure -- it was like hearing someone scratch his fingers on a blackboard.
Bush voters were more positively motivated. Political reporters had a hard time picking this up. His job rating was weak, but Bush voters tended to have a lot of warmth for him.
He had carried us through 9/11, he had confronted our enemies directly, he had pushed through with bipartisan support popular domestic measures like his education bill and the Medicare prescription drug benefit.
His criticism of his opponents was measured and never personal, and he blamed none of his difficulties on his predecessor (who had blamed none of his on his).
This affection evaporated pretty quickly, in the summer of 2005, with scenes of disorder in the streets of Baghdad and New Orleans. But it was there in 2004, and you can see it in that 23 percent turnout increase.
The 2012 election was different. Barack Obama got 6 percent fewer popular votes than he had gotten in 2008. And Mitt Romney got only 1 percent more popular votes than John McCain had four years before.
In retrospect, it looks like both campaigns fell short of their turnout goals. Yes, examination of election returns and exit polls indicates that the Obama campaign turned out voters where it really needed them.
That enabled him to carry Florida by 1 percent, Ohio by 3 percent, Virginia by 4 percent, and Colorado and Pennsylvania by 5 percent. Without those states, he would have gotten only 243 electoral votes and would now be planning his presidential library.
But the conservative bloggers who argued that the Obama campaign's early voting numbers were below target may have been right. If Mitt Romney had gotten 16 percent more popular votes than his predecessor, as John Kerry did, he would have led Obama by 4 million votes and won the popular vote 51 to 48 percent.
Romney, like Kerry, depended on voters' distaste for the incumbent; he could not hope to inspire the devotion Bush enjoyed in 2004 and that Obama had from a diminished number in 2008.
But to continue this counterfactual scenario, if Obama had won 23 percent more popular votes this year than in 2008, he would have beaten Romney by 85 million to 69 million votes and by 54 to 44 percent.
In reality, Obama's vote and percentage went down. Considering what happened in Bush's second term, that suggests a course of caution and wariness for the re-elected president and his party.