The answer to this question will depend on your home state. Some states are judicial foreclosure states, some states are non-judicial foreclosure states, and some states like Maryland are quasi-judicial foreclosure states.
Judicial foreclosure: Delaware, Pennsylvania. In a judicial foreclosure state, the lender will file a complaint seeking a money judgment and mortgage foreclosure. This is very much like a conventional lawsuit. The homeowner has the opportunity to file an Answer to the complaint and assert any possible defenses.
Most of these cases are resolved by entry of a default judgment (if the homeowner doesn't answer) or summary judgment (if the homeowner does file an answer but there are no legitimate defenses to the foreclosure). Once the lender has a judgment they need to enlist the sheriff to schedule a sale. The sheriff's sale is usually done at the sheriff's office in a large public room. That process can take about six to ten months from start to finish.
Some states require a lead time before the lender can actually file the complaint. In Pennsylvania the lender is required to give 33 days. In states like Delaware, the lender actually has to have a mandatory mediation to give the homeowner a chance to negotiate a loan modification. The mediation can add 60 days or more to the process. This time is added to the six to ten months that will run before a homeowner will lose the right to stay in the home after default.
Non-judicial foreclosure: Virginia. In an non-judicial foreclosure state, like Virginia, foreclosure and eviction can happen very quickly because the courts do not get involved in the process. Many mortgages in Virginia require lenders to give homeowners a 30-day notice and right to cure before beginning the process. Failing a cure, and depending upon the language in the mortgage or deed of trust document, the creditor can schedule a foreclosure sale and have the sale after publishing in a local newspaper after two, three or four weeks. A commissioner reviews the sale and expenses and a deed can be transferred approximately thirty days after sale.
Quasi-judicial foreclosure: Maryland. In Maryland there are more complex rules. A lender can't file a complaint (called an Order to Docket) before the later of (a) 90 days after default or (b) 45 days after sending the homeowner a Notice of Intent to Foreclose. The lender must wait another 45 days after service of the Order to Docket on the homeowner (if the lender can't serve the homeowners after attempts on two different dates, the lender can post the Order to Docket on the home). Just as in Delaware there's an opportunity for mediation in Maryland, but unlike Delaware the process is not mandatory; the homeowner must ask for a stay of the foreclosure sale to allow mediation to proceed if the lender does not agree.
Under some timelines, up to 270 days must pass before there's going to actually be a Maryland foreclosure, and even then a court must ratify the sale, the buyer needs to go to settlement and, if the homeowner refuses to leave, obtain a court order to evict the homeowner from the house. It is not surprising in Maryland for a homeowner to be able to remain in a home for a year or more after default.
In all of these jurisdictions a homeowner may file a Chapter 13 bankruptcy case to stop the foreclosure sale and attempt to cure the default over 60 months so they can keep their home. Many people file that bankruptcy right on the eve of the foreclosure sale so that, even if the bankruptcy ultimately fails, they can maximize the time they can stay in their home.