The mob mentality in "Lord of the Flies" develops because the boys lose their own values and principles to follow the louder and more persuasive Jack. When the boys lose their identities and form a mob during their pig hunts, that helps to distract them from their abandonment on the island and also allows them to avoid direct blame for any actions.
This initial discipline is needed because the boys must be able to hunt the pigs in order to eat. Ralph is able to work as the leader and provide the discipline and organization that the group needs in order to be successful at hunting pigs. However, the group breaks into a frenzy while hunting. They begin chanting things such as, "Kill the pig!" and "Cut his throat!"
In "The Lord of the Flies," the worst moment of the mob mentality comes when the boys kill Simon, one of their own. Simon returns to the group to tell them that the beast that they found is actually a dead pilot. However, when he comes back to the group they are in hysterics and it is during a thunderstorm in the middle of the night. The boys mistake Simon for the beast and attack and kill him. Simon's death is due to the mob mentality of the group.