America’s longest, most expensive, most polled, most scrutinized, most studied presidential campaign comes to an end Tuesday with unexpected candidates on the ballot.

In 2005, Republican Party insiders expected Sen. George Allen of Virginia most likely to be the nominee. His biggest selling point: He was the candidate who most resembled George W. Bush. Today, Allen is out of the Senate and the president is virtually in hiding.

On the Democratic side, Hillary Rodham Clinton was the clear betting favorite, her biggest rivals likely to be Al Gore and John Edwards, both now out of elected politics, likely for good. Barack Obama was a freshman senator from Illinois with a funny name, known largely for an eloquent address at his party’s 2004 convention.

In early 2007, handicappers of the Republican race might have picked former New York Mayor Rudolph Giuliani or the actor-politician being described as the second coming of Ronald Reagan, Fred Thompson. You surely would not have tabbed John McCain, whose moment had seemingly come and gone in 2000, and whose campaign by that summer was broke and trailing by double digits.

Obama, a rookie at national politics, out-campaigned, out-fund-raised and outmaneuvered politics’ most best and most successful political machine, the Clintons. Obama had the nomination wrapped up by last March. Hillary Clinton, perhaps disbelieving that she could lose to this kid with an ingratiating manner and no particular credentials, held on until June.

McCain pulled one of the great Lazarus acts of our political history, and by the end of last January the nomination was his. The challenger who dogged him the longest was a former governor of Arkansas known for an engaging sense of humor and extreme weight loss, Mike Huckabee.

McCain blindsided his party, and everybody else, with his choice of Sarah Palin to be his running mate. Obama picked Joe Biden, a veteran senator with a windy tendency to go off message. It says something about the evolution of this race that of the four major-party candidates, the quirky Biden is the closest to a conventional politician.

At the outset of this campaign, the two overwhelming issues were said to be the Iraq war and immigration. Both issues have receded greatly, to be replaced by a single overwhelming issue: the health of the nation’s — and the world’s — financial system. In 2005, no one thought subprime mortgages and credit default swaps would become a part of the national vocabulary.

What a long strange campaign it has been. The end is not what anyone imagined at the beginning. But in the final analysis, this is a credit to the flexibility and openness of our political system. We are, in the end, a democracy and a very successful one. Election Day is the proof.