The great majority of cases don't go to trial. Instead people are threatened with punishments vastly disproportionate to their purported crimes, and thereby intimidated in to pleading guilty irrespective of their guilt. Defendants without the financial/social resources to mount a solid defense don’t want to take their chances when faced with a 20 year prison term or whatever, not to mention a slow process that leaves their life in limbo for months or years even if they do eventually prevail. A NYT story a few years ago claimed 97% of federal cases and 94% of state cases end via plea bargain.
For those who do go to trial, the right to a lawyer is often pretty weak support. Public defenders are grossly underfunded and overworked, and there is no guarantee that they will be competent or committed to the case.