The decision wouldn’t have to be made that quickly. Remember, the citizens don’t vote for the President on Election Day; we vote for electors. The electors are theoretically free to vote for anyone they want, but they’re chosen by the parties for their loyalty. So if, say, McCain were to die on the first Monday in November, the ballots would still go out printed “McCain/Palin” (which is shorthand for “The set of electors chosen by McCain and Palin’s party”), and the people would vote on that ballot. Meanwhile, the leaders of the Republican party would all get together and decide who they wanted to be the replacement candidate, and once they agreed on someone, they’d recommend to the Republican electors to vote for that other person (whomever it is). The Republican electors, being loyal to the party leadership, would presumably go along with their decision, and all cast their votes for the replacement candidate come December.
The real difficulty would come if a candidate were to die just before the Electoral College vote. In that case, there might not be enough time for the party leaders to come to an agreement on who the replacement should be, and you could end up with each elector exercising their own judgement on who the “obvious” successor would be. If they don’t all come to the same “obvious” decision, that party’s vote could be fragmented, giving the election to the other party.
Then again, there might already be contingency planning in place for situations like this. It might be that prudent VIPs from both parties have already met in smoke-filled rooms and decided “If McCain croaks suddenly, we’ll all put our weight behind Romney”, (and an equivalent decision from the Dems) or some such.