Under the First Amendment's Establishment Clause, schools (as agents of the government) can neither encourage students to practice a religion nor restrict students' practice of religion. This is why many prayers in school, no matter how innocuous they seem or how generally they may apply, are banned in school.
The Rationale for Banning Prayer
The government is not allowed to force anyone to practice a religion or attempt to persuade someone to believe in any kind of religious tenets. Public school officials are considered government employees that hold a great deal of power over a particularly vulnerable class of citizens, specifically school children.
The courts have long believed (and science now confirms) that children are less able than adults to rationally criticize the information provided by others. While at school, they are also a captive audience: children are legally required to attend school and students who buck authority face social exclusion, or worse, official punishment. These social, biological, and legal pressures make it almost impossible for a child listening to a prayer in school to excuse him or herself from school led prayer.
The power to remove oneself from prayer is important, even though the "harm" stemming from prayer may be difficult to perceive. Teachers and administrators who lead students in prayer often do so out of a genuine desire to help their students. The discipline and moral lessons learned from religion seem to be worthy values to impart to students, and prayer may be a tempting way to introduce students to these concepts. However, school led prayer forces a child who believes in a different god, or no god at all, to participate in a religion that she does not believe in, and that is impermissible under the First Amendment.
Types of Prayer Banned
Any activity that causes the school to advance one particular religion, or group of religions, over another will most likely be banned under the First Amendment. These types of activities include:
Notice that prayer is not wholly banned from school grounds. Students may pray privately anytime they wish as long as it does not disrupt the school day. This right is protected by the school's duty not to inhibit the free exercise of religion. For example, students may say grace or a short private prayer before meals, or, if they feel it's necessary, before tests. Hence, the well known quip about prayer in schools is accurate: there will always be prayer in schools as long as algebra is taught.
For more information, see FindLaw's sections on Student Speech and on the Types of Schools children may attend.