Clear enough. So what happens when Trump suddenly dies on November 1st, a week before the elections? Millions of ballots have been printed around the country. They all list "Trump president - Pence VP" or some variation on that. The electors you actually vote for are pledged to vote for Trump as president, and Pence as VP, nothing more nothing less. Those ballots are stocked and packed to be shipped to the polling places on the night of the 8th. So what happens?
a) The electors are not allowed to vote for a dead man, and they're pledged to vote for Pence as VP, not as president, so the presidential election is a formality and it goes to Hillary. However, if the Republican ticket gets a majority, it'll be Hillary/Pence in the White House.
b) The electors are allowed to vote for a dead man so they still can vote for Trump and Pence. Somewhere between the election and the inauguration, Pence is automatically promoted to president-elect and he'll choose a new VP after January 20.
c) The electors are allowed to "move up" Pence and vote for him as president. So they cannot vote Pence for VP and Kaine is automatically VP.
d) The electors are freed from their pledge to vote Trump as president and may vote for whatever name the RNC comes up with; or for whatever name their conscience dictates them.
e) Otherwise, namely: < fill in >
I'm positively curious. The only two instances where a candidate died I can think of are:
First,
in 2002, in the Netherlands, Pim Fortuyn was murdered. But as we have party lists, all votes cast for Fortuyn still went to the party total and thus to the number of seats the party got in parliament.
Second,
in 2005, in Germany, the NPD (neo-Nazi) candidate for a district seat in one district suddenly died. The election in that one district was postponed 2 weeks with new ballots printed with a new NPD candidate. The rest of the country still voted on the regularly scheduled date.
But neither is comparable with the death of a US presidential candidate.