This question is easy to answer because Sherlock Holmes explains his whole line of thinking to his friend Dr. Watson at the end of the story, after the burglars have been arrested and the two men are back at Baker Street.
"You see, Watson," he explained in the early hours of the morning as we sat over a glass of whisky and soda in Baker Street, "it was perfectly obvious from the first that the only possible object of this rather fantastic business of the advertisement of the League, and the copying of the 'Encyclopaedia,' must be to get this not over-bright pawnbroker out of the way for a number of hours every day.
That was the first clue. Holmes goes on to explain that Vincent Spaulding's (John Clay's) willingness to work for half wages showed that he had a strong motive for securing that particular situation. His trick of vanishing into the cellar was another clue.
"He was doing something in the cellar--something which took many hours a day for months on end. . . . I could think of nothing save that he was running a tunnel to some other building."
The fourth clue was the condition of Clay's trousers when Holmes rang the shop bell on the pretense of inquiring how to get to the Strand. The knees were "worn, wrinkled, and stained."
The fifth important clue was that they closed the League offices, showing that they no longer cared about getting Jabez Wilson out of the way and that they were probably going to make their burglary attempt on the bank that weekend.
Two other clues which Holmes does not mention in his summation occur earlier in the story at the end of the initial interview with Jabez Wilson. Holmes asks Wilson:
"What is he like, this Vincent Spaulding?"
After Wilson finishes describing his assistant, including that he has a "white splash of acid upon his forehead," Holmes asks:
"Have you ever observed that his ears are pierced for earrings?"
They are. From Wilson's description, Holmes obviously recognizes the real identity of this "Vincent Spaulding." Wilson's assistant has to be John Clay, a notorious criminal with whom Holmes has had dealings in the past. Holmes, however, does not share his thoughts with either Watson or Wilson--or with the reader. Spaulding's true identity does not come out until Holmes tells the bank director, Mr. Merryweather, that they are setting a trap for:
"John Clay, the murderer, thief, smasher, and forger. . . . I've been on his track for years and have never set eyes on him yet."
Then after a long wait in the dark, John Clay is apprehended as he climbs out of his tunnel.
"It's no use, John Clay," said Holmes blandly. "You have no chance at all."
Clay will be hanged for the attempted crime, as we know when he shouts:
"Great Scott! Jump, Archie, jump, and I'll swing for it!"
Many criminal offenses were subject to capital punishment in Victorian times, as we know from reading Charles Dickens' novels, especially Oliver Twist and Great Expectations. But Clay would have other crimes to pay for now that he is in the hands of the law.