It may surprise you to learn this, but your lawyer has probably been keeping in mind the possibility of a guilty verdict and what you need to mount a successful appeal since the start of your criminal trial.
It wasn't that your attorney was convinced you were going to lose -- it's just that any smart attorney tries to keep as many doorways open through which an appeal can be made if the verdict doesn't go in your favor.
Remember all those times that your attorney made an objection only to be immediately overruled? Were there times your attorney asked that something be noted "for the record" regarding a piece of evidence? Did he or she argue about the exact wording of the jury instructions?
All of those things were -- and are -- important to the possibility of an appeal on your conviction. The appeals court is looking for one of several types of errors, any of which may be in the record of your case among all those objections and notes put on record:
-- There was a serious mistake that plainly violates the law. For example, the trial judge imposed a sentence that was longer than the law allowed.
-- The evidence didn't support the conviction. This is less of a rarity than it once was, thanks to the availability of genetic evidence that can now be used to show that circumstantial evidence was in error.
-- There was an abuse of the lower court's discretion in some way. Trial court judges do wield a considerable amount of power in their own courtrooms -- if the trial court judge acted in an unreasonable manner and showed a distinct bias against you based on your race, for example, the appeals court may overturn some aspect of the case.
-- You had ineffective counsel during your trial. This is a common complaint but one that has a shaky history among appellate courts. You are guaranteed the best legal counsel -- only adequate counsel -- so an attorney's failings have to be pretty severe to warrant an appeal.
Source: Findlaw, "The Basis for a Criminal Appeal," accessed June 16, 2017