In addition to merehughes excellent answer, I would just like to add that perhaps one of the reasons Gilman was able to depict madness with such a chilling accuracy is that she herself was subjected to the "rest cure" of her protagonist in the story.
After the birth of her first child in 1887, Gilman suffered from what we would now (hopefully) recognize as post-partum depression. Severe cases were called "hysterics" (interesting to note, the term only applied to women...the uterus was thought to be the offending organ, hence the term "hysterectomy" for its removal.)
Gilman spent several months in bed and nearly lost her mind. One would think that such a practice has gone the way of the horse and buggy, but this is not so. There is a wonderful story in the NY Times revealing its continued prevalance. Sarah Bilston writes that bed rest... "is a standard means of treating just about any pregnancy-related problem in the United States. Indeed, doctors prescribe it for about one in five of all pregnant women, or around 750,000 women a year."
As a result, many women today continue to identify with Gilman's story of a woman pushed to the edge.
In the short story "The Yellow Wallpaper", the main character descends into madness. Madness is presented in the story as a 'woman's' complaint and indeed the doctors and the main character's husband cite her hysteria as being the cause. She is forbidden to read or write or otherwise engage herself intellectually. The belief at that time was that intellectual pursuits could be a cause of madness or depression in women.
If one looks closely into the story, one can see that the narrator is projecting her boredom and frustration onto the wallpaper. She is imprisoned by her role in society at the time and so she projects the image of woman trapped in the wallpaper to express her own feelings.
That's helped me a lot.