So of all the hypotheticals being thrown around during the General Election season, my favorite thus far was the friend who asked me "What happens if McCain dies before the election?" That's an obscure, interesting question to which I respond with another question – which election? The popular vote and the formal vote of the Electoral College are about six weeks apart, meaning that the correct response depends very much on when the nominee/candidate dies. And, believe it or not, there is precedent here. Seriously. I couldn't make this shit up if I tried.
If McCain/Obama died tomorrow, the candidates would be replaced according to the rules of their respective parties. For the Republicans, Rule #9 of the party bylaws states:
(The RNC) is hereby authorized and empowered to fill any and all vacancies which may occur by reason of death, declination, or otherwise of the Republican candidate for President of the United States or…Vice President…as nominated by the national convention, or the Republican National Committee may reconvene the national convention for the purpose of filling any such vacancies.
Assuming that they would not go through the logistical nightmare of re-staging the national convention, the RNC leadership would hold a meeting (with one week of public notice required) and make the call. Shooting from the hip, I imagine that the committee would choose someone based on name recognition and ability to foster a sympathy vote. Given that Sarah Palin isn't even allowed to talk to reporters, I doubt they'd thrust her into the captain's chair. A recycled name (Giuliani, Thompson, etc) would likely get the call.
For the Democrats, their charter describes a similar process. The Chairperson (in this case, Howard Dean) has the sole power to convene the National Committee and fill a void on a "National ticket." An Obama death would almost certainly be followed with the nomination of Hill-dawg, retaining Biden for continuity.
This has never happened. A candidate has never responded to a nomination by dying before the general election. The same cannot be said of responses to the election itself.
1872 was not a good year for Democrats (more accurately, 1860 to 1932 were not good years for the Democrats). In that year the party was literally unable to scrape up a nominee to run against incumbent Republican and most-popular-man-in-America Ulysses S. Grant. For shits and giggles, newspaper magnate Horace Greeley ran on the entirely made-up "Liberal Republican" ticket. Content to allow some eccentric millionaire to waste his own money rather than the party coffers, the Democratic Party simply endorsed Greeley's kamikaze run.
Predictably, Grant trounced his token opponent, although under the circumstances Greeley's 43% of the popular vote wildly exceeded expectations. Then Horace decided to die on November 29, weeks after the election but before electors cast their votes in early December. The Democratic electors, unconstrained by rules, scattered their votes among Thomas Hendricks of Indiana (future VP under Grover Cleveland) , Greeley's running mate B.G. Brown, and Georgia Governor Charles Jenkins.
That the dead candidate lost the election took much of the pressure off of the process; it really didn't matter for whom the Democratic electors voted. What if the victorious candidate died? The default option for electors would be the Vice President-Elect, but note well that this is not required. Electors could pick anyone, and in fact that is exactly how the system was originally intended to operate. Some very, very strange things could happen, and Americans could end up with a President who wasn't even a candidate at any point in the election. Or someone who was a candidate but got tossed on the reject pile.
The example of 1872 reminds us that, unbeknownst to most Americans, nearly any electoral oddity we can imagine (and disregard as improbable) happened at some point in the 19th Century.