More than 5,000 people, most of them minors, have been detained during protests at French schools, with hundreds of officers injured and 24 establishments damaged.