After Hillary’s collapse today and her doctor’s press release saying she had pneumonia speculation has soared as to what will happen if she is forced to drop out of the race. The short answer is the Democrat National Committee (DNC) rules. They would choose a replacement for the nominee. It would not necessarily be Bernie Sanders, Tim Kaine, or Joe Biden. The DNC would meet and could choose anyone they want. If they chose someone other than Kaine, he would remain as the Vice Presidential candidate. Some expect the DNC to have an emergency meeting in the near future to consider the possibility of a Clinton withdrawal.
Details about what has to happen if a Presidential candidate dies or withdraws from the race here. No Presidential candidate has ever died between the election and the Inauguration. But should that happen and if the electoral college has voted, the Vice President would become the President.
If the Vice Presidential candidate cannot serve after the Inauguration, the President nominates a Vice President and the Congress confirms him or her. That’s how Gerald Ford became President. In 1973 Vice President Spiro Agnew was forced to resign after pleading nolo contendere (no contest) to one count of bribery received when he was Baltimore County Executive. After Agnew’s resignation President Richard Nixon appointed the House Minority Leader Gerald Ford to be the Vice President. When Nixon resigned on August 9th, 1974, Gerald Ford became President.
More here and here on what happens if Hillary is forced to withdraw.