Do not believe the judge will let you stay in the U.S. if you just ask nicely. You need to have a solid case that you are entitled to an exception of the strict deportation laws.
Your chances are best if you had a green card and have been convicted of certain crimes, but have lived in the U.S. for 7 years or more, you have not been convicted of any crime, but have a US citizen husband or wife, or US citizen children, and have been living in the U.S. for 10 years or more, and if it would create an extreme and unusual hardship for your family if you were deported.
But even in these cases, you must prepare a well founded case. Do not attempt this alone, but hire an attorney. Your future in the U.S. is at stake.
Your chances are less good if you are single, have prior criminal convictions, or have been deported before. But in some cases, where deportation cannot be avoided, we might be able to ask a judge to let you leave “voluntarily.” That usually means that you will be given several weeks to prepare with your family.
In some cases, “post conviction relief” might be necessary: That means you ask a court to vacate a prior criminal conviction because mistakes were made in that case.