The first thing you should do if you are arrested is to remain calm and avoid resisting arrest. This means you should not fight or argue with the police officer, and you should not say or do anything that can be used against you later. There will be time later on to sort out what is going on if you are innocent, but the time of arrest is usually not the best time to do that. If a police officer asks you questions before or after you are arrested, you are not obligated to answer those questions. It may be wise to request a lawyer first.
Anything you say or do during an arrest will be recorded in a police report, so if you feel inclined to answer any of the questions asked of you when you are arrested, always tell the truth. A lie will only come back to bite you later on if you are charged with a crime. If you are not comfortable answering the questions when you are arrested, don't answer them. Tell the officer you would like a lawyer to be present during any questioning, but keep in mind that if you are arrested at night or on a weekend, lawyers may not be available to represent you until normal business hours. This can extend your stay in jail.
If you can't afford a lawyer, you can have one appointed for you. You can still tell the arresting officer that you would like to be represented by a lawyer before answering questions, even if you cannot afford one. It may be necessary to post a bail to get out of jail in the meantime. Posting bail after you are arrested can be done in several ways; if you own property, you can post a property bond if your property is worth two or three times the bond amount. Otherwise, you may need to contact a bail bondsman, who will often require 10 percent of the bond amount paid up front.
Remember that arresting officers often do not have the authority to bargain with you or strike deals. This is usually the responsibility of the district attorney, so if any deals are struck, be sure to get everything in writing. Otherwise, refuse the bargain or deal until a lawyer is present to walk you through the process. Stay calm and remember that you have rights; do not resist arrest, and do not say anything if it will implicate you in a crime.