"Why would Dumbledore go to the bathroom?"
The question refers to Chapter Four in The Half-Blood Prince, where Dumbledore excuses himself (very politely, as usual) to go the bathroom, in the middle of a conversation he and Harry are having with Dumbledore's old friend and former colleague Horace Slughorn. His main purpose would have been to leave Harry alone for a while with Slughorn, to let them get to know each other. But the question pin-points a theme used both cleverly and amusingly by J.K. Rowling throughout the books: In lots and lots of other adventure stories throughout literary history, people never seem to be in need of finding a toilet in midst of their other predicaments. In the Harry Potter books, the lack of toilets in other stories is revenged: Here, toilets and bathrooms are made an integral part of the story. However, they still seem to be used chiefly for other purposes than the most obvious…
Book 1 – Hermione hides in the bathroom to cry, and gets shut in with a Troll.
Book 2 - Riddle's diary gets thrown into a toilet. Moaning Myrtle, the bathroom ghost who lives in the u-bend of a toilet, is introduced. Polyjuice is secretly made in the bathroom. And last but not least, the entrance to the Chamber of Secrets is through the bathroom.
Book 4 - Harry uses the prefects' bathroom when trying to figure out the secret of the egg.
Book 5 – A Slytherin student turns up jammed in a toilet after having vanished through a Vanishing Cabinet.
Book 6 – Harry finds Draco crying in the boys' bathroom, and that's also where Harry tries out the sectumsempra curse.
Book 7 – Since Voldemort took over, Ministry employees are forced to enter the Ministry of Magic through toilets instead of through the fireplaces.
Rowling connects the Four Houses of Hogwarts to the Four Elements:
I don't remember just now in which book it is that Dumbledore first tells the story about how he had to go to the bathroom in the middle of the night and happened to conveniently find a room full of chamberpots; but the chief purpose that this story serves, is to introduce the Room of Requirement.
To return to Chapter Four in The Half-Blood Prince, and the Muggle house where Slughorn has temporarily made himself at home:
Dumbledore re-entered the room and Slughorn jumped as though he had forgotten he was in the house.
'Oh, there you are, Albus,' he said. 'You've been a very long time. Upset stomach?'
'No, I was merely reading the Muggle magazines,' said Dumbledore. 'I do love knitting patterns.'