Traffic engineer here. Generally speed limits are set by measuring vehicle speeds for about a week. The 85th percentile speed is set as the speed limit. The reasoning behind this is the assumption that most people will travel at a speed that is reasonable for the facility. Of course, politics often becomes a factor and the speed is changed to fit those pressures.
Other aspects that can be taken into account when setting speed limits is the character of the facility. For example, number of approaches (driveways, other roads, etc.), type of area (urban, rural), and classification of the facility (arterial, collector, local street).
That's the textbook answer. The reality is that most jurisdictions have some fixed limits depending on the class of road. Parks and such, 30kph. Normal streets 50. Highways 80, with 90/100 where there are no ramps/intersections/driveways/people. If we believed in the 85th percentile then we would have lots of different apparently random limits.
Instead we have limits based on polices very much separate from road conditions or actual traffic patterns. School zones are 30kph not because that's the 85th percentile but because that's the law. US highways were once capped at 55mph to save on gas during the fuel crisis (see 1974 Emergency Highway Energy Conservation Act). That certainly had nothing to do with traffic patterns. If 85% was a thing, I wouldn't cross a bridge every day signed for 50kph but where not a single vehicle is below 80 and the cops say nothing until you're over 100.
You are correct, my response is the text book answer. Often the 85th percentile is rounded to the nearest speed that matches the fixed limits. Special speed zones, schools, definitely need to exist for obvious safety reasons.
Yes, I do live in the US. Even here there is a lot of variation on how speed limits are set.
A good example happened near my home recently. A road that connects a small town (population 8,000) to a larger town (population 40,000) was the subject of quite a lot of debate. The road is a rural two lane roadway that sees about 10,000 vehicles per day. Speed studies were performed by three different groups (the small city, the large city, and the State Department of Transportation). Each of the groups determined their own speed limit recommendation, each was different. Ultimately, the State had final say on the matter and split the difference between the three recommendations. The State had originally wanted the highest speed limit of the three. The two towns wanted lower speed limits citing safety concerns and a desire to force alternate routes that would take traffic through areas with better infrastructure for the traffic load.