There have been a lot of good ideas on this thread. Unfortunately we won't solve the problems here.
In my opinion, AnyGun's comment about parents is probably the biggest factor in getting a good education. Not neccesarily two, but concerned and involved parents. It is not surprising that most of the better students have educated parents. The parents are the ones who need to instill the value of an education, give support and show their children by example. My father didn't finish his degree until I was in junior high, and then went on to get his master's degree. All while working full-time and raising a family.
I was lucky enough to be raised in a family that valued education. As a child I did not know where I would go to college or what subject I would study, but it was a given that I would go and graduate from college. My father and mother made me sure that I knew this from a very early age. My brothers and sisters also received the same message.
It takes a very special child to do well in school who doesn't have the home life that is conducive to learning. Having parents who are too busy or care more about themselves than their children's education makes it difficult for a student to study and do their homework and suceed. There are children many who overcome this handicap, but most do not.
Through out my life, I have had excellent, good, mediocre and horrible teachers. In the workforce, I have had the same spectrum of managers and co-workers, so I am not going to bash teachers or their unions. Teachers, "good or bad" have only so much control over the education of their students. If the students don't show up or come in late or unprepared there is only so much a teacher can do. One thing that school administrators can do is make sure that the teachers have the resources that they need to teach their students. They can also minimize the politics and bureaucracy so that they don't tie up their time with non-productive projects and meetings.
One of the reasons that private schools can provide a better education is because to their students education is a privilege, not a right. Private schools have much more discretion who they accept into their school and who they allow to stay in their school. They have the flexibility to remove a disruptive or truant student who takes away from the education of other students.
If you look at any good school or university, it is not the teachers or the professors that make them a good school. It is the caliber of the students and their desire and willingness to learn and suceed that makes them good.