Holmes works all this out because the hat has excellent silk material, but with a fashion of three years ago, so the man has not been able to buy a new hat since. The hat is very dusty too, and allows Holmes to see that the man's wife does not love him enough to brush his hat:
“This hat has not been brushed for weeks. When I see you, my dear Watson, with a week’s accumulation of dust upon your hat, and when your wife allows you to go out in such a state, I shall fear that you also have been unfortunate enough to lose your wife’s affection.”
So far, it seems that Holmes is thinking logically, working out, or inferring, an explanation from details which he has observed. He uses reasoning, making reasonable inferences, and can explain all his reasons for thinking why he does to the impressed Dr Watson.
When Holmes has theories too, he tests them, and, importantly, he is prepared to change his mind if his theory is proved wrong. The man dropped a goose on the road, as well as a hat, and a precious diamond was found inside the goose before it was cooked. But can Holmes be intuitive too? It seems that he can have a feeling about what the truth is. Holmes suspects that the man who dropped them was innocent, and knew nothing about the diamond. Holmes does not know this for sure, and cannot give reasons for it. But he devises a test to see if he is right.
Holmes puts an advert in the papers for the man who dropped them, to say that the man may have them again, if he visits Holmes. The man, called Henry Baker, does so, and shows no alarm that Holmes gives him a replacement goose, instead of the very one which was dropped. If the man had known about the diamond inside the goose, he would have been alarmed at not getting the same goose back. This test proves that he did not know and that Holmes was right that he was innocent.
Dr Watson says of Sherlock Holmes in "The Red, "In his singular character the dual nature alternately asserted itself, and his extreme exactness and astuteness represented, as I have often thought, the reaction against the poetic and contemplative mood which occasionally predominated in him. The swing of his nature took him from extreme languor to devouring energy; and, as I knew well, he was never so truly formidable as when, for days on end, he had been lounging in his armchair ...Then it was that the lust of the chase would suddenly come upon him, and that his brilliant reasoning power would rise to the level of intuition, until those who were unacquainted with his methods would look askance at him as on a man whose knowledge was not that of other mortals."
So Holmes has a great deal of experience in solving mysteries, he has highly developed powers of observation, and a rapid, logical mind. He is so clever and experienced, that this becomes a strong feeling or instinct, leading him to the truth. Where Holmes is especially unusual, is that he is always willing to change his mind, and never tries to distort the facts to fit a favourite theory.
If you would like to try reading a Sherlock Holmes story by Arthur Conan Doyle, and exploring his world, then I have a lesson on "The Red-Headed League", also available as a pack.
https://cafetalk.com/lessons/detail/?id=451416&lang=en
https://cafetalk.com/lessons/detail/?id=451451&lang=en
The stories were first published in the Strand Magazine, and then collected in books. The illustrations are by Sidney Paget.