A noise in the corridor alerts them that Death Eaters have gained entrance to Hogwarts. They go to help the defenders of Hogwarts, and in the ensuing battle, Fred Weasley is killed.
In these chapters, Harry and his friends return to the halls of Hogwarts, which is of course the setting for all of the other books in the series, but which has long been absent from this one. Hogwarts is much more than just a setting for the action, having been one of the chief attractions for readers of the series, and almost a character in its own right, with its living walls, statues, and portraits and its secrets that not even Dumbledore knew fully. By moving the climactic ending of the book back to Hogwarts, the author allows the school to resume its fascinating role as a character once more, and also raises the stakes of the battle between Harry and Voldemort, as the school itself, and everyone and everything in it, come under attack. For Harry to fight to save the wizarding world, or the world in general, is very abstract. For him to fight to save Hogwarts is something we can picture in detail and care about.
When Harry leaves the Room of Requirement and explores Ravenclaw, we see more reversals in relation to the previous novels. Now Harry walks through the school as an intruder and an adult rather than a student, and the crowds of sleeping Ravenclaw students seem like children in comparison to him. Professor McGonagall, who had always kept him in his place by being the strict disciplinarian, is now seen by Harry as a friend, and he lashes out at Amycus to protect her. She herself views Harry in a different light, for once not trying to order him around for his own good.
Plot developments come very quickly in Chapter Thirty-One, with Harry’s discovery of the diadem’s history and his recovery of it, his final confrontation with Draco, Ron and Hermione’s collection of the basilisk teeth, the mobilization of virtually every remaining character in the book, and the death of Fred Weasley. The book’s focus swings wide in this chapter, encompassing everything and everyone who matters to Harry, so that we can see that everything is to be decided this night.