But you have to look at the background on this. Our country was initially populated by people escaping religious persecution who were looking for a safe have to practice their own religion. When we came together as a country, we had a religiously diverse population, so when we wrote the constitution, we had to say that the government would not support any religion at the expense of others, nor would it prohibit the free exercise of religion.
Prayer in public schools was a complicated issue where there was a religious diversity amongst students and teachers, because, how could, say, Catholics and Protestants agree on a prayer to say. Now, we are talking about a school-sponsored prayer. No student-sponsored prayer is, or needs to be, prohibited. But in the Cold War, America was distinguishing itself from a Communist enemy that was known to be atheistic. So, the school district in New York decided to develop a prayer which they thought anyone who believed in God could pray. (Those of you who pray, do you ever pray generic prayers?)
Interestingly, it wasn't the atheist Madalyn Murray O'Hair who sued the school district to stop this, it was some Jewish parents, who thought that the prayers said in school would not be considered appropriate for Jewish students to pray. The Supreme Court said that it violated the establishment clause of the Constitution to have this prayer, even though the prayer was a generic prayer.