The more idealistic response to altair would be to say that schooling is mandatory because there is a hope that at least some of those kids might actually learn some of it. This is important, no matter how many kids go through school without learning anything, it's worth it if at least 1 gains from it. Especially since all kids gain in some way.
Truth is, schools ensure that most of the population gain basic literacy and numeracy. Keeping them in high school allows them to practice these skills(though some inevitably slip through the net). High school provides a place for kids to be while they are growing up and and not yet ready to be in the wide world of adult life. Hopefully, high school gives them the right skills.

Anyway, you never know who might start enjoying which part of learning until you make them try it. You have to make sure that they're not doing something because they're too cool. This wasn't what schools were about when they started but that's what it is now. Kids that age think they know it all but it's up to us to let them down gently and show them the way.

If you disagree with this writeup, node it THEN downvote!