Muggles' Guide to Harry Potter/Magic/Whomping Willow

Overview
The Whomping Willow is a large tree located on the Hogwarts grounds. It seems to be unique, it is certainly very rare; it can move its limbs, and does so with great speed and violence when it feels threatened.

Extended Description
The Whomping Willow destroys the flying car in which Harry and Ron arrive at Hogwarts in their second year; it apparently manages to injure itself slightly in this event. The Herbology teacher, Professor Sprout, is seen to have been tending it. At the same time, we learn something about Professor Lockhart, who has been "advising" her; tellingly, Professor Sprout is carrying all the tools and equipment, has been injured in the endeavor, and is looking nettled, while Professor Lockhart has not even a hair out of place.

We find out in the third book that the Whomping Willow was planted specifically to guard the entrance to a secret passage. It was actually brought to Hogwarts when Remus Lupin was a student at school. The tree hid a secret tunnel that led to the Shrieking Shack in Hogsmeade; when the full moon caused Lupin to transform into a werewolf, he could lock himself into the Shack and so avoid harming his fellow students. This particular willow can be temporarily stilled by pressing a specific knot at its base; this is the technique used by Lupin (and others) to enter the secret tunnel that it conceals between its roots. The presence of this knot is revealed to Harry and Hermione by Crookshanks; we also later see Lupin and Professor Snape using it. It is possible that Sprout knows about this, but was prevented from using it while tending the tree's injuries because of Lockhart's presence; this would explain not only her injuries, but part of her visible annoyance with him. Most of her annoyance, likely, would have been caused by his staying out of range and shouting unnecessary and probably incorrect advice, while Sprout was actually doing the hard and dangerous work.

In Harry's third year, the tree destroys Harry's Nimbus 2000 broom. We are never told whether the Willow has a particular antipathy to brooms, but it does reduce Harry's treasured broom to splinters.

Finally, we see that the Trio have to pass the Willow to reach the Shrieking Shack, where Voldemort has established his field headquarters for the attack on Hogwarts. In this instance, it is Ron who triggers the knot that stills the tree. How he knows about the knot and its function is not explained, as Sirius had already dragged him into the tunnel when Crookshanks revealed its operation to Harry and Hermione;

Analysis
There is a technique of tree-trimming much practiced in England, and places following the English model, where major branches of a tree are cut quite short and repeatedly. This results in a tree with stubby branches and large round growths on the ends of its branches. These, looking like knuckles on the ends of the branches, could easily inspire the idea of a tree that acts as if it has fists.

Like many of the obstacles Harry faces in his endeavors, the Whomping Willow is impersonal; it neither likes nor dislikes Harry, it simply defends its secret against all comers. Other similar obstacles are Fluffy, the three headed dog, and most of the other barriers between Harry and the chamber where the Philosopher's Stone is kept in the first book. We suspect these challenges are intended to illustrate to the reader how not all obstacles are malign; they would, and do, act the same no matter who is challenging them. Harry's reaction, showing dismay, for instance, when his broom is destroyed, without having the urge to destroy the Willow, shows maturity and likely is intended to teach that sort of mature response to adversity. It is to the author's credit that the lesson is not belaboured, as that makes it much more likely to be accepted.

Greater Picture
In the final book of the series, Voldemort uses the Shrieking Shack as a command post. As he attended Hogwarts before Lupin, the tunnel to the school may not have existed in his day, and the Whomping Willow certainly did not. The Trio have to pass the Willow and traverse the tunnel in order to determine what Voldemort is doing. Voldemort is clearly unaware of the tunnel, as the Trio do not encounter any difficulty other than the Willow in reaching the room where Voldemort is holding court.

The effort to pass the Willow results in a bit of byplay between Ron and Hermione that echoes an event in the first book. As mentioned in the Extended Description section, there is no explanation for how Ron knows to still the tree, as he was dragged into the tunnel before Crookshanks demonstrated the operation of the knot. We suspect that having Ron still the Willow was done specifically to allow that echo from the first book, and his not having earlier seen the knot being used was an oversight on the author's part.