Education has been replacing some tasks with machines for years. Copy machines, thank fuck for copy machines! I will never get tired of the luxury of shoving pages into a machine instead of writing them by hand. Calculators! Projectors! Those standardized tests have been machine scored for ... four decades or so? Online classes!
You can learn most subjects just fine on your own, especially if you have a website designed to provide extra support rather than just reading or watching a video. But just reading or watching a video will teach you tons of stuff. That means the need for actual schools has dropped dramatically. You can accomplish the vast majority of it at home now.
What can't be automated or computerized? The social stuff. But only a tiny number of schools actually teach that. (See Grace and Courtesy.) How long do you think people will keep paying teachers and providing a building for students to hang out? Especially when they're getting shot at? That doesn't seem very robust for the future. Child warehousing is popular, of course, but the need for that drops if more and more parents are either unemployed or working from home, which is where the job market points.
So what else is left? The classes that require close student-teacher interaction are mostly the fine arts and soft sciences. Music, dance, creative writing, sculpture, painting, linguistics, foreign languages -- you need someone right there to show how it's done and correct mistakes. The same goes for shop and home ec, which for a while replaced the practical skills that students used to learn at home, and now have largely been dispensed. But people still need to know how to assemble a book case and cook without lighting the kitchen on fire. Really. Some advanced job skills fall into this category too, for colleges -- learning to identify plants via dissection, for example, or repairing cars. Most of this stuff is not something that machines can do at all well.
The other thing is another social one: mentoring. Youth benefit from having adults, preferably adults who resemble them in meaningful ways, to guide them through life. Machines can't do this. Sure, you can have "socially programmed" robotics but let me just tell you now, if you turn kids over to those, they turn out very weird in ways that most adults dislike. Humans are malleable enough to imprint on another species, and yes, that can happen with machines if actual primates are unavailable.
Well, the social stuff can be done in any gathering place: a library, a community center, a church, a fellowship club, whatever. Most of the person-to-person education is already offered in separate classes (dance) or private lessons (music). Mentoring can be done through any of those venues, and additionally, should be offered anywhere you have new people coming into learn stuff, like at work.
We don't actually need schools anymore. I don't think most people have realized this. They'll figure it out as it moves along, especially if people don't fix the extremely grave problems with public schools today. Schools are only one way to learn things, and right now, they're not even a very good way. Other solutions are possible. So if the school system wants to outcompete all that other stuff, it better get its act together.
Robots aren't the real threat, though. Society is.