Edit: after reading some other comments, I should note, the lottery system is problematic. We got lucky and got a good school near us, and SFUSD stats show most people get one of their top few choices. But in a worst-case scenario, you have a long commute to a bad school--and you leave. The intention is good--to make good schools available to everyone, not just those who can afford the good neighborhoods. But until you land your kids in a school you're ok with, it's a big stressor.
http://elizabethweise.com/2014/03/21/1-in-3-san-francisco-sc...
However, I find a lot of people erroneously believe that San Francisco schools are generally bad, or that you have to really luck out to get a good school assignment. I'd say that SF schools are mixed. If you go onto "greatschools.net" and sort by test score, you'll find that SF has an unusually high number of very high performing schools for an urban district. It also has an alarming number of poorly performing schools.
Here's the thing - do the same search on the peninsula or in marin, and you'll find essentially the same thing. The difference is that in SF, you can't automatically convert a high mortgage payment into guaranteed access to a top school. Nor does poverty condemn you to a poorly performing one.
Although a good assignment is not guaranteed, it's hardly a long shot. The way the system worked when I was going through it is that you list 7 choices. If you create a good, balanced lists, and look for some good schools that are under the radar, you do have a good (but again, by no means guaranteed) crack at a decent placement.
Of course, the reality is that high income people can and will leave if they don't get an assignment they like, so SF does lose families this way.
The whole situation is horrible.