what happens if a presidential candidate dies?

Constitutional scholars are nearly unanimous in opinion that any state law binding the electors to the popular vote is unconstitutional. Such laws contradict the whole purpose of the Electoral College, which was to allow an override to the popular vote.