The Twenty-fifth Amendment which deals with the succession to the Presidency
establishes procedures both for filling a vacancy in the office of the Vice President, as well as responding to Presidential disabilities.
Disabilities includes insanity which is dangerous not only for the US citizens, but also for the whole world.
According to the Constitutional Topic: Presidential Disability on www. usconstitution.net;
Step 1 - declaration of disability
To remove a President from power, the Vice President and a majority of
the department secretaries must send a message to the Speaker of the
House and the President Pro Tempore of the Senate stating that the
President is unable to fulfill his duties as President. Note that the
majority is of "the executive departments" and not of "the Cabinet."
The Cabinet is often used as a shorthand term for the executive
departments, but the Cabinet actually consists of other persons, such
as the White House Chief of Staff and some agency heads. These people
are not a part of the 25th Amendment process.
Once this message is signed and sent, the Vice President immediately
becomes Acting President.
Step 2 - declaration of ability
If the President is not physically disabled, such as being in a coma,
he may disagree with the actions of his Vice President and department
secretaries. If he does disagree and is able, he can send his own
message to the Speaker and President Pro Tem, stating that his is able
to perform as President. In this case, the President is immediately
restored to full power as President.
Step 3 - redeclaration of disability
Once the President disputes the original declaration, a clock starts
ticking. If within four days of the President's objection the Vice
President and the department secretaries again declare the President
disabled to the Speaker and the President Pro Tem, the decision of
disability falls to the Congress.
Within 48 hours, the Congress must convene if it is not already in
session. Another clock then starts ticking. Twenty-one days after the
Vice President's second declaration, the Congress must decide if the
President is disabled. If the Congress so decides, by a required
two-thirds majority of each house, then the President must step aside
and the Vice President becomes Acting President. While the Congress
decides, the Vice President holds the position of Acting President. If
the Congress agrees that there is a disability, then the Vice
President continues as Acting President. If there is no two-thirds
majority within 21 days, the President resumes his position.
Step 4 - resumption of power
Though the 25th Amendment does not address the issue directly, it
never actually allows for the removal of the President - only for the
Vice President to become Acting President. There could come to pass a
time when the President is able to resume his duties. Presumably, if
the Vice President agrees at any time that the President is able, he
can give up his powers as Acting President. It also seems clear that
if the Vice President were to lose the support of more than half the
department secretaries, the President would also resume his duties.
It will all depend on the judgement of Vice President, department secretaries and Congress. No President has been replaced by Vice President due to their disabilities in the US history. Eight Presidents were replaced due to death and the only case where Vice President became President due to resignation was Gerald Ford (replacing Richard Nixon).