Under the 1949 NATO treaty, the exit process seems simple. A country submits a formal notice, and one year later, they are out.
But under US domestic law, it is a completely different story. In 2023, legislation was passed to prevent any president from resigning unilaterally.