When the judge sets your conditions of release, it will usually be in the form of "Bail" or a "PR" release. A PR release means that no bail is required and you are released on your "personal recognizance" and promise to appear. If the court isn't willing to give you a PR release, they will usually set bail in some amount. You then have the option of posting the amount of cash required, or arranging to have a bail bondsman post it for you. The bail money is kept by the court as an assurance that you will return to court. If you fail to return to court on an assigned court date, your bail may be forfeited, meaning that the court keeps the money and a bench warrant is issued for your arrest. If a bail bondsman puts up the money and you fail to appear, he loses his money and has the right to track you down and arrest you and haul you back into court to get his money back. In order to perform this service of posting bail on your behalf, the bail bondsmen will charge you 10% of the bail amount as a separate and non-refundable fee. So if your bail is $10,000, he will charge you $1,000 in cash and will then put up the $10,000 with the court.
It's usually a good idea to hire a lawyer before you put up bail because the lawyer will have an opportunity to argue for a lowered bail or PR release, possibly saving you the cost of bail at the time of arrest. The downside is that you'll have to wait until your case is called in court and the lawyer is present. Bail bondsmen, on the other hand, are available 24 hours a day and located near the courthouse. The bail bondsman will typically want collateral (like a mortgage or other property) before agreeing to post bail.
There are other alternatives to bail. A court could order you to be released on Electronic Home Detention (EHD), or "house arrest". A tracking ankle bracelet is placed on you and a landline telephone is required at the residence where you're going to stay. Compared to a PR release it's quite limiting, but compared to jail it's a huge improvement. One major advantage of EHD over PR release is that the time spend in EHD is credited as time served in jail in the event you are later sentenced to jail time.