There are plenty of websites devoted to fighting speeding tickets. Many of these sites advise you not to exclaim that you were just going with the "flow of traffic" when you appear in court. This is great advice! Why? First of all, if you tell the judge that you were simply going with the flow of traffic, you may be admitting to speeding. But more importantly, the "flow of traffic" has no bearing under most circumstances.
The State of California defines speed laws in CVC sections 22348-22352. In a nutshell, the State sets prima facie speed limits at 25 mph for school and senior zones, along with residential and business zones. The speed limit for alleys, uncontrolled railroad grade crossings and certain intersections at 15 mph. These speed limits are defined and not open to interpretation under the basic speed law. The only exception is if the roadway has been legally posted otherwise. So, if you are driving through a posted school zone with children present (25 mph), you may be cited for speed if you were travelling faster than the posted limit. Yes, even if you are in a group of vehicles and just going with "the flow." This is a common misconception, especially near schools when the 25 mph zones are being enforced.
Like the prima facie speed limits, the State also sets maximum speed at 65 mph unless legally posted otherwise. This applies primarily to our freeways. The speed limit is set and any driver travelling faster may be cited for speeding. Yes, again, even if everyone else is driving faster. If you feel that by driving the speed limit you are impeding the flow, then move to the right and stay in the slower lanes. Traffic does "flow" too fast. It is up to everyone to reduce highway speeds.
Local jurisdictions do indeed have the right to set local speed limits. Violations of posted limits in these areas fall under the basic speed law in California. A violation of a posted limit is written when the driver is travelling at an "unsafe speed" for conditions. It is up to the issuing Officer to determine and later prove to the court if the citation is contested, the safe speed for the roadway. Speed limits are set based on many factors; roadway conditions, type of area, cross traffic, visibility, number of lanes, just to name a few. If an Officer is conducting speed enforcement, they will also use other factors such as time of day, weather, amount of traffic, and more, when they determine at what speed a violation has occurred. And yes, even though the basic speed law is a bit more flexible, the "flow" of traffic is not a blanket excuse to drive fast.
Speed laws are set to protect all drivers and keep our roadways safe. Please be cognizant of your speed and drive within posted limits.