Where do these various terms for "detective" come from?
Funny, but no one really knows.
These terms have been part of the fabric of detective fiction for years and, one has to assume, the real nitty gritty patter of life on the street--or prison--where most slang shows up first.
Now, according to my best reference, the Oxford English Dictionary, the source that records when a word was at least written down for the first time, a Gumshoe might refer to the gum-soled or rubber-soled shoes used by detectives to do their best sneaking around. Or the idea that a detective who is sneaking around might be better served wearing gum-soled shoes. But here, from the horse's mouth in black and white from the venerable OED, the first mention in print:
1906 A. H. LEWIS Confess. Detective 198 You're d'gum-shoe guy I was waitin' fer... It was Inspector Val tells me to lay for you.
1907 Springfield (Mass.) Weekly Republ. 4 Apr. 2 He..was forced to accomplish his ends by main strength rather than by gum-shoe methods.1908 J. M. SULLIVANCrim. Slang 11 Gumshoe worker, a private detective; a spotter.1913 H. A. FRANCK Zone Policeman 88 159 But the ‘gum shoe’ naturally cannot twirl a police club.1927 D. HAMMETT in Black Mask Nov. 21/2 He..looked me up and down, growled: ‘So you're a lousy gum-shoe.’
Shamus is a bit trickier. The OED doesn't know for sure. It might be for the given name "Seamus", an Irish name which might then refer to a cop on the beat or someone with the same accuity in catching criminals as a cop. This is the one pronounced with a long a, "Shaymus." That's how I've always pronounced it, always thought it was pronounced that way. But if you watch the 1941 The Maltese Falcon directed by John Huston and starring Humphry Bogart as the definitive Sam Spade, Bogart pronounces it Shahmus, soft a. Which might lend credence to the other derivation in the OED which is Shames(h), a Jewish term which means a beadle or sexton in a synagogue, first mentioned in 1650. Originally more like a sacristan who helps prepare for the service for the rabbi, but then latter more of a bouncer: 1903 Standard 27 Apr., There is a ‘shammas’ acting as beadle, door-keeper, collector, cook, and utility-man in emergencies.
Last but not least, Dick. As in private dick, or even Dick Tracy. The OED says it's a private detective or policeman. But as far as the etymology, there's a great big question mark. Though they seem to think it might derive from an abbrevtion for detective. Here's what the OED says:
1908 J. M. SULLIVAN Crim. Slang. 8 Dick, a cop, detective (Canadian slang).
1912 A. H. LEWIS Apaches of N.Y. 95 Still, those plain-clothes dicks did not despair.1924 Amer. Speech I. 151/2 ‘Dick’ and ‘bull’ and ‘John Law’ have become established as names for the police.1928 E. WALLACE Gunner xxix. 234 They'd persuaded a couple ofdicks--detectives--to watch the barriers.1956 J. D. CARR P. Butler for Defence xiii. 140 Plain-clothes C.I.D. men..are currently known as bogeys, busies, dicks, and scotches.
Canadian slang? Our venerable crime-speak is Canadian? *shrug* Of course, the listing gave us a few more I haven't heard of: busies and scotches. Funny thing is, there are no entries in the OED for those.
I'd better get my best Shamus on it.

