If either candidate dies before their respective conventions, the Republicans on 7/15 to 7/18 and the Democrats on 8/19 to 8/22, then the convention becomes an open convention, with deals being made to select a new candidate.
If one of them dies after the convention, it’s up to the party to pick a replacement, likely the VP candidate, but it doesn’t have to be.
If the winner of the election dies after the election, it gets incredibly messy, again, depending on the timing.
There’s a good novel on that hypothetical called “The People’s Choice”.
With either candidate, it all depends on timing.
If either candidate dies before their respective conventions, the Republicans on 7/15 to 7/18 and the Democrats on 8/19 to 8/22, then the convention becomes an open convention, with deals being made to select a new candidate.
If one of them dies after the convention, it’s up to the party to pick a replacement, likely the VP candidate, but it doesn’t have to be.
If the winner of the election dies after the election, it gets incredibly messy, again, depending on the timing.
There’s a good novel on that hypothetical called “The People’s Choice”.
https://en.m.wikipedia.org/wiki/The_People's_Choice_(novel)