In the Penal Code, the first listed factor for the judge to consider is "protection of the public." In fact, it says "public safety shall be the primary consideration. Most people think that bail is designed to make sure a defendant shows up to their court appearances. That's true, but the law says that in determining whether to set bail and for how much, public safety is the main consideration.
Seriousness of the offense
The next factor is the seriousness of the offense. In considering this, the judge must include any alleged injury inflicted, alleged threats, alleged use of a firearm or other weapon and any drug usage. Unlike the rest of the criminal justice system where you are presumed innocent, it's the exact opposite when the judge is setting bail. They must assume the charges are true. Yes, they will listen to your lawyer when discussing the facts of the case, but it's from the starting point that the allegations are all true.
Of course, the judge can and will consider any prior convictions that you may have on your record - particularly whether or not you're currently on probation for another case. If there are past convictions for the same conduct, the odds of bail being set and/or increased go up.
The final consideration in Penal Code section 1275 is the "probability of (the defendant) appearing at trial or hearing of the case." This is where any past failures to appear, even on traffic tickets, can weigh against you. If you have strong ties to the community, a job and supportive family present in court, it may make the judge feel more comfortable that you will appear in court as ordered.