Election results are the product of all kinds of things: economic conditions, political conditions (a midterm, a party holding many or fewer seats), voters judgments of the candidates' policy stances, money, candidate charisma, and other things. Of course, the exact proportion of each of these is impossible to pin down. Here's what I wrote after President Obama's win in 2008:

In reality, no president ever truly has a mandate, in the sense of the electorate voting for him as if his entire platform were a ballot initiative. Candidates' platforms play a role in who wins elections, but so do economic conditions, scandals, the candidates' personalities, and the Election Day weather in Philadelphia. The proportion of each factor is variable, though sometimes the broad contours can be seen. (Lyndon Johnson's 1964 landslide was clearly more of an ideological affirmation than Jimmy Carter's 1976 post-Watergate squeaker.)

The post-election spin game usually consists of the winning side characterizing its victory as a pure policy referendum, and the losing side dismissing its loss as a flukish product of pure circumstance. If you want to watch the spin game in action, read Jay Cost's triumphal analysis in the Weekly Standard. Here's Cost on why the Republicans won:

Dissatisfaction was not limited to the sluggish pace of economic recovery. Voters also disapproved of the health care bill, the stimulus package, and the level of deficit spending; they expressed a sense that government has become too big and too intrusive. 
More than half of all voters said that President Obama’s policies will “hurt the country,” and the general impression left by the reams of exit poll cross tabs is that in 2010, the American people agree with Ronald Reagan’s declaration, “Government is not the solution to our problem. Government is the problem.” Despite their disapproval of the Republican party, voters disliked the Democratic party enough to give the GOP another chance.
None of this is much of a surprise, except to those who refused to believe the rebuke was coming. Pollsters Scott Rasmussen, Pat Caddell, and Doug Schoen have been warning Democrats for some time that the midterms would be calamitous for them. Liberals ignored them during the campaign, and many will continue to do so, preferring to see the results as a consequence of the irrational wrath of voters who wrongly punished the Democrats for the failures of the Bush administration.

So Republicans won because Democrats were too liberal, plain and simple. Ignore all those political science models showing economic growth and Democratic overstretch alone would have given the GOP a majority.

Now, if the election was a pure ideological rebuke, how did Democrats win in 2008? After all, the health care plan, cap and trade and the like were all in the platform and part of the debate when Democrats won a huge victory. How did that get past the discerning public? Here's Cost:

The GOP lost its majority because of “black swan” events—a war going badly in 2006 and a catastrophic economic collapse right before the 2008 election

The amazing thing is this passage appears in the very same article. When Republicans win, it's due to ideological factors. When Republicans lose, it's just a black-swan fluke. You see Republicans make this argument all the time -- the economic crisis supposedly had a huge impact in 2008 but none in 2010, despite the fact that the effects of the crisis had barely been felt in 2008. (By the way, it's also bizarre that the Iraq War can be called a "black swan" event. The Bush administration both bungled and manipulated the intelligence, and then utterly botched their war plan. That's not a fluke, that's the kind of thing you deserve to be punished for at the ballot box.)

The thing is, Republicans do have a pretty strong non-ideological explanation for 2008 -- the economy was terrible and had been terrible for eight years:

Real income for the median American household went from $51,356 in 2001 to $52,163 six years later—an increase of just 1.6 percent.

That chart actually understates the case, because personal income growth fell in 2008. Basically, the economy -- not just the crisis but the whole Bush-era economic cycle -- made it nearly impossible for Republicans to hold the White House in 2008. I suppose conservatives don't want to say this because it undercuts the rationale for the Bush tax cut, which were supposed to increase economic growth over the Clinton years.

For what it's worth, I wrote after last week's election that unpopular policies contributed to the Democrats' loss:

I think the root of the Democrats' political troubles lies in the initial flurry of activity--the stimulus, restructuring TARP, and the auto bailout. In the public mind, this all become jumbled together as "the bailouts" -- a conflation carefully nurtured by Republicans--even though obviously Keynesian fiscal policy is not the same thing as a bailout. But the truth is that all those policies were highly unpopular, and all came to symbolize big government rescuing bad actors while average people paid the bill. It became a frame that colored perceptions of the entire Democratic agenda.

But I generally agree with political scientists that structural factors like the economy were the main part of the story.