Residents for tax purposes are generally required to file Form 1040 or one of its variants (Form 1040A or Form 1040EZ). Non-residents for tax purposes are generally required to file Form 1040NR (or its variant, Form 1040NR-EZ). For those who are nonresidents for tax purposes, the relevant information about when the person was present in the United States, and the calculations based on that to show that the person fails the SPT, are done in Schedule OI, which is the fifth and last page of Form 1040NR. Those who would otherwise qualify as residents for tax purposes under the SPT, but are seeking an exemption, may need to file additional forms (such as Form 8840 or Form 8843) as discussed in the exemptions section.
