It is very skillfully done, especially in the opening of the story, where the lottery is referred to as one of the common activities of the town while not disclosing its true purpose. In fact, at the beginning we are led to believe that the town is as normal as any other, and that will eventually contrast dramatically with the gist of the story:
They greeted one another and exchanged bits of gossip as they went to join their husbands. Soon the women, standing by their husbands, began to call to their children, and the children came reluctantly, having to be called four or five times. Bobby Martin ducked under his mother's grasping hand and ran, laughing, back to the pile of stones.
As you move onto the story, you sense something is horribly weird. The characters being to take a subtle hue of curiosity and it all becomes darker and colder. Also, you see the atmosphere changing within. This also includes the juxtaposition of the name "Mr Graves" next to the phrase "We are next"
We're next." Mrs. Graves said. She watched while Mr. Graves came around from the side of the box, greeted Mr. Summers gravely and selected a slip of paper from the box. By now, all through the crowd there were men holding the small folded papers in their large hand. turning them over and over nervously Mrs. Dunbar and her two sons stood together, Mrs. Dunbar holding the slip of paper.
After the Hutchinson fate began to be revealed, the anxiety of the lottery begins to be felt and that is when we realize what this may be:
Tessie Hutchinson was in the center of a cleared space by now, and she held her hands out desperately as the villagers moved in on her. "It isn't fair," she said. A stone hit her on the side of the head. Old Man Warner was saying, "Come on, come on, everyone." Steve Adams was in the front of the crowd of villagers, with Mrs. Graves beside him.
"It isn't fair, it isn't right," Mrs. Hutchinson screamed, and then they were upon her.
Concerning Jackson's "The Lottery," I agree with the answer above that the most important element of the story that enables the horrific ending to work is the representation of the setting and characters as normal until the actual result of the lottery is revealed.
I'll pick up where that thought leaves off, and suggest that the point of view is crucial to how the setting and characters are presented. The point of view is detached. It reports what is seen, heard, etc., but does not interpret, explain, or make value judgments. The story could not work with any other point of view, particularly first-person (the person telling the story would know the truth) or omniscient (every mind read would know the story). The story is narrated in an objective manner which enables the surprise ending to work and create horror.
In my opinion, the author achieves horror in this story by making most of the story sound so completely ordinary.
Throughout most of the story, it sounds like the people of the village are just gathering for some sort of normal and probably fun even. Sure, we see the rock piles, but they sure don't seem threatening until you know what is going on.
To me, the horror of this story is how normal the people and the setting are. This underlines Jackson's main point -- that ordinary people in ordinary circumstances are still capable of real evil.
For me the build up produced horror. The author sets the reader up by painting a visual picture of a pleasant afternoon gathering of people from a farming community. It is a nice day and the children have gathered rocks. Some of the children even made a pile of rounded rocks. She used every trick to throw the reader off in the beginning of the story.
The townspeople seem pleasant towards one another. They joke and talk with each other and the setting feels safe. She has lured the fly into the spider web.
As the author reveals the true dynamics of the lottery, the reader begins to feel the tension increase. The situation is no longer safe. Tessie has become the fly caught in the web as she awaits execution. The reader is even more horrified when it is revealed that the people committing the hideous stoning do not seem to even bat an eye. Their life goes on as normal, even the family that had lost the mother/wife.