Pledge of Allegiance was written by Francis Bellamy. Originally reading "I pledge allegiance to my Flag and the Republic for which it stands, one nation, indivisible, with liberty and justice for all."
The original salute required people to face the flag and perform a military salute, place the right hand on the heart and being reciting, and after reciting the words "To the Flag" people extended an arm toward the flag.
Added the words "The Flag of the United States of America." between "I pledge allegiance to" and "And to the Republic."
Lillian and William Gobitas were practicing Jehovah's Witnesses and commanded their children not to salute the flag in school. The children were consequently expelled, and the Gobitas family sued the schools. The Supreme Court decided that Boards of Education have the right to expel students who do not participate in saluting the flag.
Instead of saluting, you put your right hand over your heart while facing the flag.
Barnette sued the West Virginia Board of Education under the pretense that requiring students and faculty to salute the flag is a violation of the First Amendment. The Supreme Court agreed, and overruled the prior courts decision of Minersville School District v. Gobitis.
Pledge we know today is used. "I pledge allegiance to the Flag of the United States of America, and to the Republic for which it stands, one nation under God, indivisible, with liberty and justice for all."
Due to the threat of communism, President Eisenhower encouraged Congress to add the words "Under God" after "One nation"
Michael Newdow sued the Elk Grove Unified School District for requiring his daughter to say "One nation under God" saying it violated the First Amendment. His case did not make it past the Ninth Circuit because he did not have legal custody of his daughter whom he brought the case upon, and was discarded due to procedural law.