A trial is set up in a particular way to make sure everyone who goes through a trial gets the same chances. To start with, you may have the opportunity to settle your case out of court with the help of your attorney. In those instances, you'll be working on a plea bargain.
What is a plea bargain? It's a negotiation that leads to a penalty or agreement that both sides of the case are happy with. For instance, you may be able to plea to a lesser charge or could have the case dropped if you agree to give up information on someone else. Plea bargains help you avoid going to trial, the publicity it could result in, and helps you avoid harsher penalties.
Plea bargains are completed privately for the most part. The changes that are taking place today make it possible for the victims to weigh in on the process, though. Until your plea bargain is agreed upon and goes to court for the judge to agree to it, it won't be heard publicly.
Usually, your plea bargain will have to be approved by the court, except in a few rare circumstances. The judge does not have to accept a plea bargain if he or she does not find it to be fair. There may be other agreeable alternatives that the judge suggests, like going on probation and entering a diversion program. This would result in expungement in most cases once probation has been completed, which means your criminal record won't be affected in the long run.
Source: American Bar Association, "Steps in a Trial: Plea Bargaining," accessed May 17, 2016