The line of succession refers to the order of individuals who would become President if the current President (and, if applicable, those higher in the line of succession) dies, resigns, or is removed from office. In 1967, Congress passed the 25th Amendment, which modified the line of succession as defined in Article II of the Constitution.
The 25th Amendment ensures a stable transition when the President or Vice President is unable to complete their terms. The amendment states that if a President is forced from office, dies, or resigns for any reason, the Vice President becomes President. If the Vice President leaves office, then the President is allowed to select a new Vice President. His selection must be approved (confirmed) by a majority vote of both the House of Representatives and the Senate.
Far from being a theoretical problem, a plan of succession has frequently been necessary. On eight separate occasions, a President has died in office and several other times, the President has either resigned from or been removed from office. Similarly, on seven occasions, the Vice President has died in office and one Vice President–Spiro Agnew-resigned in the middle of his term. This has meant that for nearly 20% of U.S. history, there has been no Vice-President in office who can assume the Presidency.
www.justicelearning.org, The United States Constitution, what it says, what it means, A Hip Pocket Guide (Oxford University Press)