Is there any foreshadowing that points out the surprise ending?
Early descriptions that characterize the protagonist also prepare us for the fact that she will be overcome by joy at her husband's death. For example, "she does not react" to the news as other wives might. And then the narrator says, "She was young, with a fair, calm face, whose lines bespoke repression and even a certain strength." Both "repression" and "strength," together with this "thing" arousing inside of her, prepare us for the joy she is about to experience. Her "strength" proves ironic, for it is that aspect of her character--her extraordinary sense of freedom--that ultimately kills her. Chopin often has her heroines die at the end of her stories, unable for one reason or another to "fit in" with ideologies of womanhood. For Chopin, "strength" in a woman dooms her. She wrote this at the turn of the 19-20th centuries.
The very first sentence foreshadows what will happen at the end. It reads "Knowing that Mrs. Mallard was afflicted with a heart trouble, great care was taken to break to her as gently as possible the news of her husband's death." The knowledge that she has heart trouble in the very first line hints that this will become a factor later in the story, and indeed it does when she dies of a heart attack in the end.