Both the Republican and the Democratic parties have rules in their bylaws governing how to fill the vacancy. The Party Chair calls a meeting of the National Committee, and the Committee members at the meeting vote to fill the vacancy on the ticket. A candidate must receive a majority of the votes to win the party's nod.
The same process would happen if the vacancy were to occur after the general election but before the Electoral College voting. If a vacancy should occur on the winning ticket, it would then be the party's responsibility to fill it and provide a candidate for whom their electors could vote
After a hiatus I've decided to pop my head back in.
A fictional book called
The People's Choice discussed this. The president/VP won by a narrow margin, about 30 electoral votes, then three days later fell off his horse during a parade and died from complications. Everyone assumes "Oh ****, Teddy Block [the VP-elect] is going to be our president!" A special session of the Republican National Committee met to "elevate" Block to the Presidency-elect, nominated some ineffectual, oddball congressman from Rhode Island as VP-elect, and instructed the electors to vote for Theodore Pinckney Block for
President and congressman Sherwood Phelps for Vice-President. Pretty straightforward.
Well, actually no. One of the delegates, a Michigan elector, says "point of order!" and explains to the assembly of party faithful that that's actually illegal. The election, she points out, is over; 538 electors have already been elected, a majority of them with instructions to vote for MacArthur Foyle for President and Theodore Block for Vice-President, not for President; and that the only obligation the RNC could put the electors under is to vote for Block for VP, as per those instructions.
Turns out that in that situation, the presidency was more or less up for grabs. (One chapter began with the sentence: "...the opening bell rang for what historians would come to call "The Great Turkish Bazaar"." The electors started openly buying and selling their votes by the middle of the book.) Remember, FEDERAL law doesn't matter. Nor do party regulations, because the constitution already has settled who has what authority when it comes to presidential elections, and the election of electors. Congress has the authority to COUNT the electoral votes--and thus, by extension, to collectively order a particular vote invalid--but the States (specifically the state legislatures alone) have the authority to pass laws governing the election of the electors. The states have an absolutely fercockta plethora of individual variations, apparently, on what would happen in the circumstance you mentioned.
And even if there are laws binding an elector to his/her pledge, says this book, it is doubtful that they are enforceable. The most the other electors can do is send in a statement along with their certificate that elector so-and-so's vote for Mickey Mouse, or whoever they decided to vote for improperly, was "not regularly given"--again, Congress has the authority to count (or refuse to count) said votes.
So says the book. It is of course fiction but it's based on fact, and the author claims to have researched the matter.
https://www.amazon.com/Peoples-Choice-Novel-Jeff-Greenfield/dp/0452277051/ref=sr_1_1?ie=UTF8&qid=1475665172&sr=8-1&keywords=the+people%27s+choice+jeff+greenfieldPretty fun read.
But I digress, and so have the rest of you. Early voting: we decided this in Maryland a few years back. I was--and still am--against it wholeheartedly. The General Assembly proposed the amendment to the state constitution to allow early voting. I voted against it, but my fellow citizens were dumb enough to go for it.