(Click the character infographic to download.)
Since Conan Doyle is a good detective story writer and not an idiot, he doesn't introduce Stapleton, the villain of The Hound of the Baskervilles, with any obvious signs that he's our bad guy. Obviously, he wants to build up the suspense. So instead of appearing with a dripping knife in his hand, Stapleton goes running up to Watson in the local village with a butterfly net to introduce himself as a gentlemen living in the area.
Stapleton strikes us as a bit of an oddball right away, with his butterfly net and his running off into the treacherous bog of the Grimpen Mire after a rare specimen. But not for long do we think of him as an eccentric but harmless Victorian amateur scientist like Doctor Mortimer.
Evidence starts to mount up pretty quickly that something's a little off. During Watson's first walk with Stapleton to Merripit House (the place where Stapleton's living with his sister), there's that sudden appearance of Beryl to warn Watson (who she thinks is Sir Henry) to go back to London right away. And then there's Stapleton's intense interest in the Hound and his knowledge that Holmes has gotten involved in the case.
Probably most suspicious is Stapleton's reaction to Sir Henry's marriage proposal to Beryl. His explanation that he's too attached to his sister to let her get officially engaged isn't very convincing, even if Sir Henry accepts it more or less at face value. When Holmes lets us in on the secret that Beryl Stapleton is actually Mrs. Stapleton, and not his sister, it confirms what the book vaguely hints at beforehand. As Watson says:
All of my unspoken instincts, my vague suspicions, suddenly took shape and centred upon the naturalist. In that impassive, colourless man, with his straw hat and his butterfly-net, I seemed to see something terrible—a creature of infinite patience and craft, with a smiling face and a murderous heart. (12.44)
There are lots of unexpected twists in this book, but the fact that Stapleton's the murderer doesn't come out of nowhere. The book builds in details that hint at his involvement long before Holmes informs us for sure that he's guilty.
So, using the character of Stapleton, The Hound of the Baskervilles is teaching us to pay attention. (So sit up straight and put down that phone this minute!) Yes, there are things in this book that we could never predict, no matter how Holmes-like we try to be. But Conan Doyle structures his plot so we get rewarded if we read closely. By taking note of everything Watson observes and hints as he investigates the area around Baskerville Hall, we can follow the thought processes of Holmes and Watson straight to Stapleton. This book teaches us to be amateur detectives ourselves.
The Hound of the Baskervilles is all about inheritance: Sir Henry inherits a bunch of money and a possible family curse from Sir Charles, which starts the ball rolling. Stapleton needs money, which his family has, so he plans murder to get his hands on the cash. But in addition to the legal question of who gets the Baskerville money, Conan Doyle also throws in these issues of biological inheritance. So, when Holmes sees the portrait of Hugo Baskerville, the bad guy who started this whole Hound business by kidnapping a local girl, he immediately sees Stapleton's face staring out at him.
Once Holmes shows Watson the resemblance between Hugo Baskerville and Stapleton, he comments that their similarity is "an interesting instance of a throw-back, which appears to be both physical and spiritual" (13.63). In other words, Stapleton hasn't only inherited his evil ancestor's looks, but he has also inherited his moral flaws. Stapleton is like a physical manifestation of the Baskervilles' bad side.
When Stapleton sinks into the Grimpen Mire, leaving Sir Henry to rightly inherit the estate, it's not just a matter of good winning out over evil. It's also a question of biological survival of the (morally) fittest. The fact that Sir Henry gets to carry on the family legacy suggests that the Baskerville rep will improve, leaving the dark legends of Hugo Baskerville behind.