https://fivethirtyeight.com/features/what-happens-if-a-presidential-nominee-can-no-longer-run-for-office/
Let’s tackle that first scenario — something happens to either Biden or Trump before their respective conventions. In the case of the Democratric nomination, that would all of a sudden open up the race, according to Lara Brown, director of the Graduate School of Political Management at George Washington University. The delayed primaries would become far more relevant, and this could create a free-for-all with Sen. Bernie Sanders and the other candidates. “Let’s face it, none of the candidates have officially withdrawn,” said Brown. “They’ve all just suspended [their campaigns].”
But if tragedy didn’t strike until the convention, Biden delegates would have to choose someone else to support.1 Richard Pildes, a constitutional law professor at the New York University School of Law, stressed, however, that even under normal circumstances, the Democratic delegates are technically free “on the first ballot to vote their conscience.” As for the GOP convention rules, Pildes told me they specifically bind the delegates, and as Trump is the only candidate who will really have delegates, the party might need to issue an “interpretation” of the rules or even vote to change them to deal with this unforeseen situation.