how does a person end up in jail?
Imagine you are at home, mowing your lawn. Suddenly, police officers come to your yard and question you about your whereabouts last night. You tell them that you were at home, watching TV with your wife and kids. They do not believe you, and arrest you because you match the description of someone who committed a crime. This means that first, law enforcement makes the decision to arrest you - or not.
If you do not have money for bond, you spend a night or two in jail until you go in front of the judge (arraignment). Here, your charges may be dismissed, or not. If your charges are not dismissed, and you do not have money for bail, you remain in jail until the trial unless the judge releases you on your own recognizance (RoR). The trial takes place after a few weeks or several months. All the while, you remain in jail while maintaining your innocence.
At the trial, you are found innocent, but because you spent the last months in jail, you lost your job, your house, and your car because you could not make payments.