The prohibition against causing pain to animals is a serious one, and is treated as such by Jewish Law, which not only forbids man from causing pain to animals, but also bids him to help relieve the pain of animals.
I spoke to a renowned Jerusalem veterinarian to find out what putting an animal to sleep involves, and under what circumstances the procedure is done. She told me that she would do this only for animals that had been in an accident and the ensuing treatment would be too costly, or for pets dying and in pain.
Once, when she was working at a university animal clinic a woman wanted her dog "put down" for an unusual reason: She had just redecorated her house and her "lovey, lovey, koochie koo" no longer matched the decor! Even though the veterinarian suggested giving the dog up for adoption, the lady refused, stating that if she couldn't have her "lovey, lovey" then no one could!" The doctor refused to cooperate in this case.
The general method for putting an animal to sleep is to give it an anesthetic such as Phenobarbital. Once the animal is asleep it is given an overdose. Every effort is made to make the process painless.
I asked a great Rabbi in Jerusalem for a ruling regarding putting animals to sleep if deemed necessary by owner and doctor. He told me that it would be halachically permissible to put an animal to sleep since it is a painless procedure. However, he noted that there is a Kabbalistic tradition that forbids the ending of any life.
Rabbi Aryeh Levin told a story about a walk he once took with Rabbi Kook. While they were walking, Rabbi Levin "absent-mindedly" pulled a leaf from a tree. Rabbi Kook stopped and asked him why he did that. "Why I did what?" responded Rabbi Levin. Rabbi Levin related that Rabbi Kook illustrated to him how one should be very careful about life, even the life of a leaf.