Who will be the new nominee?
The US Constitution does not have any rules or procedures to fill in the vacancy, thus the party gets to decide.
The parties will get to decide their new nominee. The vice-presidential candidate will not be given any special consideration, and will remain if another candidate is selected. Nor will those candidates in the primaries.
They can pretty much choose anyone they want, just that the candidate can garner enough votes from the officials. There's no line of succession.
Both the Democratic Party and the Republican Party follow similar procedures.
According to the rules of the Democratic Party, the Democratic National Committee is responsible to nominate another nominee. Party officials would each cast one vote at a special meeting and the winner is whoever gets the majority. Party officials would be the "superdelegates".
Article Two, Section Seven of the Democratic Party bylaws states that
"a special meeting to fill a vacancy on the National ticket shall be held on the call of the Chairperson."
For the Republican Party, the Republican National Committee will choose the new nominee.
Since the nominees are officially nominated by their party, the party cannot force them to step them. Only the candidates can make the decisions themselves.
How about those who already voted?
For all of those voters who already cast ballots through absentee or early voting, the new candidate will get all their votes.
This is because when voters are not really voting for a presidential candidate but instead voting to select the representative that will represent their state at the Electoral College.
Representatives of the Electoral College, who are bound a particular candidate according to their state's results, will then meet in December to officially elect the next American president.
Articles to check out:
I've found some articles that addresses this issue and would be useful to check it out: