An international student is at risk of accruing unlawful presence in the United States if he or she remains in the U.S. beyond the period of authorized stay. Exactly when your unlawful presence actually begins to accrue will depend on your particular nonimmigrant student status.
If you studied in the United States in J-1 or F-1 student status, you will not start to accrue unlawful presence until a formal determination has been made by U.S. Citizenship and Immigration Services (USCIS), or a related government authority, that you are in the United States unlawfully.
This is different from most nonimmigrant statuses, where unlawful presence will begin to accrue the moment status is not being maintained or when the visa holder has overstayed the period authorized on Form I-94 Arrival/Departure Record. F-1 and J-1 students are treated differently because they are admitted to the country for "duration of status" (otherwise known as "D/S"). D/S is granted to F-1 and J-1 students because the regulations recognize that academic programs are not fixed in duration, and that there is an option for these students to participate in optional practical training (OPT) when the program is completed.
D/S does not mean that it's impossible for F-1 or J-1 students to overstay -- your stay in either one of these statuses is authorized only through the end of your grace period. In fact, determinations of unlawful presence are often made when an F-1 or J-1 student files a change of status application after an overstay.
However, it does mean that you can overstay without accruing unlawful presence so long as a determination of unlawful presence is not made. Once you are determined to be here unlawfully, the time you overstayed before the date of that determination will not count as unlawful presence. For example, if you overstayed 90 days before the date of determination and you depart the country ten days later, you will have only accumulated ten days of unlawful presence.
If you studied in the United States in M-1 student status, you were admitted for a fixed period of time, which is indicated by the end date on your I-94. Unlike F-1 and J-1 students, you will start to accrue unlawful presence if you remain in the country after the end date on your I-94, or sooner if you otherwise violated your status. This rule also applies to foreign nationals who are studying incidental to another nonimmigrant status, like H-4.
The punishment for unlawful presence is severe. The regulations provide that 180 days of unlawful presence will result in a finding of inadmissibility and a three-year bar to U.S. reentry. If you accumulate 365 days or more of unlawful presence, you will be subject to a ten-year bar to reentry. (For more on this, see Consequences of Overstaying on a Temporary U.S. Visa.)
In order to avoid such a harsh punishment, you need to act immediately upon finding out that you have started to accrue unlawful presence. If you have not yet accumulated 180 days of unlawful presence, you may want to consider leaving the country to stop the clock. If you are unable to leave, or you have accumulated more than 180 days of unlawful presence, you should consult with an immigration attorney about what options you may have available.