In many schools the only way to opt-out without receiving significant grief for doing so is to claim a religious exemption to pledging to things. I saw kids receive perpetually refilling detentions for refusing to say the pledge, though at the time I found it weird that they would refuse.