How do you deal with an 'on the way out' pet?

My heartfelt sympathy to the OP. I have had to do this several times with furry family members in the last 40 years. My current vet is the best - comes to our house where the dog or cat is most comfortable and at peace. She is so gentle and caring. And after caring for this animal for years, she does this final thing for nothing, and always cries with us when it is over. I hope this is my option when I go. My father died in agony with cancer for years and my mother lived for years with dimentia not knowing who anyone was, always terrified of everybody and anything. Their religion led them to that end and it was their choice, but not one I would make.