Muggles' Guide to Harry Potter/Places/Shrieking Shack

General Overview
The Shrieking Shack is famed as the most haunted place in Britain. It is a small house, set well away from Hogsmeade village, is fenced off, and has all its windows and doors boarded up.

Prisoner of Azkaban
The Shrieking Shack gained its reputation some ten or twenty years before our story begins, when loud howls and shrieks emanated from the building at odd times.

In Harry Potter and the Prisoner of Azkaban, we learn that the Shrieking Shack is reached via a tunnel starting beneath the Whomping Willow, an animate willow tree with a nasty temper. The shrieks and howls were actually produced by Remus Lupin, who is a Werewolf. When Lupin was a boy, the Shack was used to contain him during his monthly transformations, allowing him to attend Hogwarts. Once transformed while in the Shrieking Shack, he was unable to escape, and no one could enter without knowing the secret of the Whomping Willow, thus ensuring everyone's safety. Additionally, as the Shack is so remote from the Hogwarts grounds, nobody is likely to connect the sounds from the Shack with an absent Hogwarts student, thus allowing Lupin to keep his lycanthropy a secret.

These revelations are made inside the Shrieking Shack near the end of Harry Potter and the Prisoner of Azkaban. Harry and Hermione follow the tunnel to rescue Ron, who was dragged there by a large black dog. The dog is actually the Animagus form of Sirius Black, who was attempting to catch Scabbers, Ron's pet rat. Scabbers is unmasked as Peter Pettigrew, another Animagus who betrayed Harry's parents to Voldemort, then framed Sirius Black for a crime he never committed. The group is joined by Lupin, who explains his, Black's and Pettigrew's relationship to Harry's father, and about the Whomping Willow and the secret passage under it.

Deathly Hallows
The Shrieking Shack makes another appearance in Harry Potter and the Deathly Hallows, where Voldemort makes it his headquarters for the first assault on Hogwarts. Voldemort has uncovered a window to watch the battle. He is apparently unaware of the secret passage to Hogwarts; Harry, Ron, and Hermione use it spy on him, and also witness Snape's death from its concealment.

Analysis
The Shrieking Shack, and its secret connection to the school, are an interesting way of rendering the werewolf Lupin safe within the student body at Hogwarts. The Wizarding world must, of course, be more aware of the existence of magical transformations like lycanthropy, and similarly must have some sort of way of planning for these occurrences. It seems perhaps a bit primitive to deal with what is evidently a disease by isolation, but that does seem to be a way of minimizing the risk to others, and Dumbledore's willingness to go to this extent to allow Lupin to be educated at Hogwarts is an indicator of the sort of efforts he is willing to make on behalf of his charges. One could see Phineas Nigellus Black, for instance, faced with this same sort of situation, simply denying admission to any potential werewolf student.

Greater Picture
The connection between the Shrieking Shack and Hogwarts, and the reputation of the Shack, very likely had nothing to do with Voldemort's selection of the building for use as a command post in the battle for Hogwarts at the conclusion of the final book. We can assume that, as Tom Riddle was long gone from Hogwarts when Lupin arrived, the Shrieking Shack holds no fears for Voldemort, and may have seemed only a conveniently-located vacant building he could use as an observation post. Additionally, he was probably unaware that the tunnel existed, as even though both Wormtail (Peter Pettigrew) and Severus Snape had used it, they would have seen little point in mentioning it to Voldemort. We note that Snape seems unsurprised to see Harry in the Shack after Voldemort has dealt him a fatal blow, near the end of the final book. Snape's earlier use of the tunnel may have been a factor in his lack of apparent surprise at Harry's sudden appearance, though Snape being very near death at that moment may have had more to do with that – he may simply have not been capable of much surprise at that point.

Also of interest are the author's reasons for selecting the Shrieking Shack as Voldemort's command post. While it is not necessary that any command post be in direct line of sight from the school, as Voldemort presumably could use magical means, including Legilimency, to observe the battle progress from a distance, it should be close enough that he can dispatch messengers like Lucius Malfoy. The author, however, knew that this would be the place where Snape died, and the place where he transferred his memories to Harry; it is safe to assume that she had planned the revelation of Snape's motivations from the start of the series, and the plot had carried things to the point where this had to be done. Thus, Voldemort's command post had to be close enough to the school for Harry to reach it, despite the intervening battle lines, yet far enough away that Voldemort did not feel that he was putting himself in danger; and it had to be somewhere that Harry, looking through Voldemort's eyes, would recognize. Finally, it had to be relatively private. This last requirement rules out almost every building in Hogsmeade, despite the likely partial abandonment of the village during the Death Eater occupation and Hogwarts attack; Hogsmeade residents and Death Eaters would still be wandering around most buildings. About the only place that meets all these requirements is the Shrieking Shack, with its protected tunnel that secretly crosses the battle lines.