Dr. Roylott is responsible for his own death, because his murder weapon turned on him.
Dr. Roylott trained his snake to kill his step-daughters. Therefore, he is really the one to blame when the snake turned on him and killed him. Holmes knew about the snake, but there was no way he could predict what it would do.
When Helen Stoner hires Sherlock Holmes, she explains that her sister died an unexpected and unusual death and gives him some background on the family and Roylott.
Violence of temper approaching to mania has been hereditary in the men of the family, and in my stepfather's case it had, I believe, been intensified by his long residence in the tropics.
Holmes and Watson come to Stoke Moran, where they see many unusual animals. They sit quietly in their room in the dark. Holmes waits next to a grate for the snake to appear. They hear a whistle and follow the snake back to Roylott. He is dead.
“It is a swamp adder!” cried Holmes; “the deadliest snake in India. He has died within ten seconds of being bitten. Violence does, in truth, recoil upon the violent, and the schemer falls into the pit which he digs for another. …”
Holmes says that when a doctor goes bad, he goes really bad. Doctors are supposed to help their patients, and they are intelligent enough and know enough about the body to compose terrible crimes. However, Roylott becomes the victim of his own brilliance when his own snake turns on him.
Holmes says it is all for the best when Roylott dies. This saves them the cost and difficulty of a trial. Helen Stoner now has nothing to fear (as long as she can get rid of all of those animals). The case has a happy ending, for everyone except for Dr. Roylott that is!