Authors use surprise endings to have a greater impact on their readers. Shirley Jackson was particularly interested in shocking her audience, which she could not have done had she given away the ending sooner. She made her intent apparent in this quote:
I hoped by setting a particularly brutal ancient rite in the present and in my own village, to shock the story's readers with a graphic dramatization of the pointless violence and general humanity in their own lives.
Violence is one of the overriding themes of the story. It is clear by Jackson's statement that she wanted to make a point. Many times a story's theme is used by the author to share a life-truth with the audience. Some themes are common: don't judge situations or people by appearance; love is stronger than hate; etc.
Another author who wrote in this fashion was Kate Chopin in "The Story of an Hour." It is not until the last line that the true irony of the story is conveyed to the audience, but the end is no less surprising, and is particularly effective. Chopin challenged the accepted roles of women in society in the late 1800s. Even today, one of the most effective aspects of the tale is its surprise ending.
Some authors, however, write to entertain. Leaving the details until the end in adventure stories or horror stories, allows the author to better entertain his or her audience. Examples of this include O'Flaherty's "The Sniper" and the eerie "A Rose for Emily" by William Faulkner—all hoard the details of the story's final moments until the very last moment, often allowing for little or no falling action in the plot development.
There is a literary excellence in this kind of story, and authors will take great pains to achieve such unexpected endings. For example, in "A Rose for Emily," Faulkner mixes up the chronology of events—using flashback and foreshadowing—making the story line jump between several different time periods to keep the audience from anticipating the ending. Rereading the story allows the reader to see examples of foreshadowing and flashback, which only further demonstrates the author's artistry.
Jackson's continued references to rocks are examples of foreshadowing, but out of context, they don't appear threatening. The casual behavior of the townspeople also misleads the reader. By the time the members of Tessie's community attack her, the sudden release of violence is unexpected and especially impactful. For Jackson, she is making a point. For other authors, their intent may be to please their audience by offering up an unexpected surprise at the story's end.