The speaker of the U.S. House of Representatives is second in the line of presidential succession, after the vice president. In order for the speaker to qualify as president, both the president and vice president must be unable to occupy the office due to death, resignation, removal, inability or disqualification.
To qualify for the office of president, the speaker of the house must resign as both speaker and as a U.S. Representative. If the speaker does not do so, the presidency moves to the president pro tempore of the U.S. Senate, who also must resign his post. The line of succession continues to the Secretary of State, Secretary of the Treasury, Secretary of Defense, Attorney General, Secretary of the Interior and so on.