The answer to your question has not actually been reviewed by the Supreme Court, but is largely held by a decision made in Arkansas called Koch v. Adams. In the case a young man had his phone seized for two weeks where in the school refused to give him the SIM card.
The student sued the school claiming that the confiscation violated his rights and at the very least they should have given him the SIM card to protect his right to privacy.
The ruling enforced the importance of school documentation and maintaining a paper trail. Because the school had a clear policy that had been explained to the student and the student's parents; because the student had signed a contract specifically outlining the consequences of phone usage at the school; and because the school did not search the student's phone, the school's right was upheld to follow policy and confiscate the phone according to the rules set by the school.
Because of this particular ruling, schools are responsible for informing students and parents of the rules, keeping documentation of warnings and parent conferences that try to solve the problem, and their reasoning for the confiscation. If they follow these guidelines, they can keep the items for as long as the consequence policy stipulates.