Sometimes the law is on your side, but the finder of fact is not. If you went to trial you have the right to appeal your conviction by asking a higher court to rule on whether or not the court where your case was heard followed all of the rules of evidence and applied the law correctly. Appeals are a uniquely academic process, but a powerful tool in criminal defense. If the law is on your side, no matter how bad the facts are, it is the job of the appeals court to say so.
There are also some times when an appeal may be taken before the first trial occurs. This is a rare occurrence, but when available, is usually worth pursuing, because you have nothing to lose but time.
Preparing an appeal in a criminal case begins with preparing a written record of the trial proceedings and carefully reviewing any evidentiary issues raised during the trial, and even those which were not. The next step is crafting an argument that, even granted a reading of the evidence in favor of the state, that one or more of the essential elements of the crime(s) was not proven.
Unfortunately, given the process, most appeals are conducted with the appellant being held in jail, and there are procedural limits on starting the appeals process, which mean that it is very important to begin the paperwork as soon as possible to make sure you preserve your rights to pursue an appeal.