Holmes is able to make clever deductions from minute pieces of seemingly inconsequential evidence. He demonstrates this when he is able to explain how Miss Stoner arrived at Baker Street-
The left arm of your jacket is spattered with mud in no less than seven places. The marks are perfectly fresh. There is no vehicle save a dog-cart which throws up mud in that way, and then only when you sit on the left-hand side of the driver.
He decides which areas he needs to examine in order to determine the real events of the crime, and to defend Miss Stoner from any harm-
When you combine the ideas of whistles at night, the presence of a band of gipsies who are on intimate terms with this old doctor, the fact that we have every reason to believe that the doctor has an interest in preventing his stepdaughter's marriage, the dying allusion to a band, and, finally, the fact that Miss Helen Stoner heard a metallic clang, which might have been caused by one of those metal bars that secured the shutters falling back into its place, I think that there is good ground to think that the mystery may be cleared along those lines.
Holmes is able to rule out the gypsies, and by examining the rooms of Dr Roylott and Miss Stoner, to establish the bizarre course of events.