Just to add some further detail to the previous couple of answers, the narrator of this short story shows the general mental deterioration that exists between postpartum depression and postpartum psychosis. It is this latter stage, the one where our narrator finds herself crawling around the room in endless circles, that obstetricians everywhere are trying to prevent by asking a few simple questions after childbirth. (For example, they ask, "Do you feel sad sometimes?" "Do you ever feel like you can't handle your current situation?" etc., etc.) However, the setting of this story doesn't allow for the current knowledge of postpartum psychosis, so everyone simply leaves what appears to be a crazy woman up in her room, apart from her newborn child. Thank goodness for the wonders of modern medicine!
The woman in "The Yellow Wallpaper" becomes obsessed with the patterns on the wallpaper and begins to identify with them. To specifically answer your question, the narrator is trying to free the woman trapped in the pattern, by tearing the wallpaper down. Of course, this is symbolic of the narrator's own entrapment.
When she can't peel all of the wallpaper off, she begins circling the room as if she is trapped inside the wall and following the pattern of the wallpaper. By the time her husband comes home and faints after he sees her crawling against the wall, she has lost touch with reality and appears to have become the woman in the yellow wallpaper.
That, I hope, explains the narrator's behavior at the end of the story.
The narrator is a female who lived during a time when she had very little control over her own life. Her husband and the doctor are both males and it is their decision to convince her that she has a nervous condition. This was not uncommon among women whose husbands had money during the era.
The woman is trapped in the bedroom that she did not like to begin with. She had pleaded with her husband to allow her to be downstairs and not locked away in the room that she does not like.
The more time she spends in the room, the more she observes the pattern and begins to see it changing and moving as if it were alive. Her loss of freedom has finally caused her mental deterioration.