If you come to the U.S. on a K-1 fiancé visa, which is given to foreign nationals for the purpose of entering the U.S. and marrying a U.S. citizen, realize that your visa cannot be renewed. You are expected to get married within 90 days and either apply for adjustment of status (a green card) or leave the United States.
But if something happens and you were not able to marry within the 90 days—yet the marriage is still what you want—your best bet is likely to go ahead and marry. As long as the U.S. immigration authorities have not caught up with you before you are ready to submit the green card application, you should be able to apply for it through normal procedures, as explained below.
If you marry after the 90 days permitted by your K-1 fiancé visa, your spouse will have to submit an I-130 visa petition on your behalf. (It is similar to the Form I-129F that he or she filed in order to start the process of getting you a K-1 visa, but this form is used for married couples.)
Because you are already legally in the U.S., the I-130 can be submitted with the rest of your green card (adjustment of status) application, which includes Form I-485 and additional forms and documents. You will send it all by mail to U.S. Citizenship and Immigration Services (USCIS). Form I-130 shows your eligibility to immigrate (this time as the immediate relative (spouse) of a U.S. citizen, rather than as a fiancé) and your spouse's willingness to support your application.
Another consequence of marrying after the 90-day expiration of your visa is that you will be living in the United States unlawfully for a time. Although this is a serious concern, it is unlikely that the immigration authorities will search you out in the near future. The agency has higher enforcement priorities than going after people who will ultimately have the right to a green card but are simply late in applying for it.
Don't even think of leaving the United States if you have stayed six or more months past the expiration date on your fiancé visa. If your 90 days is up and you still haven't filed your green card or adjustment of status application, you are in the United States unlawfully. However, leaving the U.S. and starting the process over could be the worst thing to do at this point. If you have stayed in the United States more than six months beyond your visa expiration date, leaving would subject you to laws preventing your return for three or ten years. For more on this topic, see Consequences of Unlawful Presence in the U.S. -- Three- and Ten-Year Time Bars.
If you are late in getting married and turning in your green card application, and the immigration authorities (most likely Immigration and Customs Enforcement, or ICE) do catch up with you and place you in removal proceedings, it is not a complete disaster. You can apply for your green card before the judge in Immigration Court.
The application paperwork is mostly the same as if you were applying to USCIS. However, you will still need to get USCIS approval of the I-130 before the court can move ahead, and this can take many months.
Also, the law requires the judges to look even harder at your case than a USCIS officer would. That means you will have to do extra work to convince the judge that despite your late marriage, this marriage is bona fide, with the intention of you and your U.S. citizen spouse establishing a life together; not just a sham to help you get a green card.
You'll definitely want a lawyer's help to pursue a green card while in removal proceedings.