So the constitution pretty well covers what happens if no one gets an electoral college majority in the presidential election. Under the twelfth amendment the House picks from among the top three electoral vote earners and chooses a president. The Senate similarly picks from among the top two VP candidates.
Then Section 4 of the twentieth amendment adds that:
The problem is that congress for whatever reason has never actually done this. We don't have a legal provision for what to do if the election is thrown to the House, but then one of the candidates dies.
If it happened, Congress could pass such a law establishing how to choose a replacement. The easiest thing to do would probably be to say that the electors who voted for the deceased candidate can choose a replacement. Or you could establish some system for letting the party pick a replacement. The problem of course is that if you have, for instance, an extremely polarized Republican House and Democratic Senate, good luck passing legislation for an emergency fix that'll determine who gets to be president for the next four years.
So...
Scenario 1:
It's 2016. A razor close contest between Hillary Clinton and Chris Christie results in a 269-269 tie. Republicans narrowly maintain control of the House. The electors meet in December and cast their votes. Then Chris Christie dies somehow. Does the Republican House have to elect Hillary now? What happens?
Scenario 2:
A three-way race. Let's say we've got a strong centrist independent candidate. Let's say it's Jon Huntsman for the purposes of this hypothetical. Huntsman gets 10% of the popular vote and manages to get himself a couple electoral votes and screws up the election in the process. Hillary Clinton wins the popular vote but is just barely denied an EC majority. Democrats have the House in this scenario. Then Hillary dies suddenly. Are House Democrats stuck choosing between Christie and Huntsman? Do they go with Huntsman as the compromise candidate even though he has no claim to a popular mandate?
Scenario 3:
Same as #2 with Democrats picking the president except Christie actually won the popular vote.
See the problem?
My guess is you'd have to have some kind of grand bargain in congress (reminiscent of 1876) to pass emergency legislation to replace the candidate who died. One party would get the presidency and the other would get some major concession.