Lord of the Flies, by William Golding, is an allegorical novel, as mentioned in the answer above. What happens with these boys on this island is a microcosm (a small picture) of what is happening in the rest of the world, and the ending reminds us of that.
The boys on this island have no adult supervision and no laws or restrictions to keep them in line; their only governance is their own self-control, something they demonstrate almost from the beginning that they have very little of. Jack and his hunters transform into savages, and by the last chapter of the novel every boy on the island--except for Ralph--is either dead or part of Jack's tribe. Golding rarely uses any names besides Jack or Ralph in this chapter, referring to all the other boys simply as savages.
Jack has mandated that Ralph must be killed, and his savages try to obey their chief. Soon a fire is lit which parallels the fire they lit at the beginning of the novel; soon it is out of control and threatens to consume the entire island. Ironically, the fire which was set to kill Ralph is also the fire which signals a passing military vessel and ultimately saves them.
The final images of the novel, when the crisply uniformed naval commander arrives, are powerful primarily because readers are reminded of several realities. First. we see these boys as they are through the eyes of the naval officer. While we see them as howling savages bent on murder, he sees them as a "semicircle of little boys, their bodies streaked with colored clay, sharp sticks in their hands, ...standing on the beach making no noise at all." We know that Ralph is running for his life from a group of savages. but to the officer he is "the little scarecrow in front of him. The kid needed a bath, a haircut, a nose-wipe and a good deal of ointment." Jack is determined to kill Ralph, but to the adult he is a "little boy who wore the remains of an extraordinary black cap on his red hair and who carried the remains of a pair of spectacles at his waist." This contrast is a clear reminder that these are mere boys, a horrible reminder of what even children are capable of without the restraints of civilization.
The naval officer jokingly asks if they have been playing war; he has no idea (until Ralph tells him) that the boys are involved in a true war. Seeing this man and his ship is a reminder to us that what has been happening on the island is the same kind of thing which has been happening in the "real" world of adults (World War II).
The impact of this intruder from the outside world adds emphasis to the events of the story and reminds us that we are not immune from such things.
The last chapter is quite powerful in terms of bringing back the boys' senses. As you may know, the time the boys spent on the island went on to reveal the devil inside themselves... "the darkness of a man's soul.."
By this point, most of the boys have become right savages and have lost touch of reality (they have moved on to some life-war games, you could say). The mere sight of an adult (the naval oficer) makes their mind crash back to Earth. Ralph finially sees a way to being rescued and he starts weeping, Jack drops his 'I-own-the-world' attitude and he goes back to speaking correctly. Overall, the mere sight of an adult brings back their civilisation; Perhaps not entirely, but it's like a force trying to get out of a cage.
Personally, I'm not satisfied with the ending because it seems to lack some detail and has left me with many questions. However, the ending is seen as a powerful impact because it leaves a message for society (just as the rest of the book as it is an alagory). It carries a message of being awaken, as an eye-opener...