You can ask the police for bail as soon as you have been arrested and taken to the police station. If they agree, they will decide how much bail you must pay. You must pay the money in cash. You must get a receipt saying how much you paid and when you must appear in court. When you have paid the bail the police must release you.
If the police will not agree to police bail, you must wait for the court hearing. In court you can ask for court bail.
The police cannot grant bail if you were arrested for a serious crime, for example rape, murder, armed robbery, housebreaking, etc.