It all depends on the individual situation - your financial resources, the medical problem, the age and general health of the pet, and your attachment to the pet.
Personally, I find that a short and useful summary.
I'm going through this right now with my cat Major. He's 14 years old and has developed a tumor in his mouth. The vet did a biopsy and it's cancerous. She said it's not the worse type of cancer but it is agressive and will grow quickly. She's a great vet and detailed my options.
She said that the most aggressive treatment, if money was no issue, would be to have Major's head cat scanned to see if the tumor had invaded his jaw and then depending what they found they could try to remove the tumor. If it was into his jaw, they'd have to remove part of his jaw, and she honestly said that cat's do not tolerate that very well - dog's do ok with that but not cats. I figured that I would at least have him cat scanned to see what the extent of the problem was but when she told me that the cat scan alone would cost $1500 - I really had to do some serious soul searching.
I love all my pets - they are my kids. But I'm out of work, Major is 14 (not super old for a cat but still elderly), if the tumor extends into his jaw there's really not much they can do and surgery would run into many, many thousands of dollars plus pain for the cat.
I decided not to go through with that. Right now, Major doesn't seem in any pain, he's still bright-eyed and active, comes for petting, meows for food. The only problem right now is that he can't eat very well. I've scoured the grocery store for things he can eat just to make sure that he's still getting the basic nutrition. I'll keep him as healthy and as happy as I can but when it becomes too difficult for him, and when he starts to have pain, I'll let him go.
I'm crying as I write this because I know it's inevitable, but in the end I think it's the best thing for both of us. Before I take him for that final visit to the vet, I'll take him outside, let him eat grass (this is the thing that makes him happier than anything), and then say good bye. I wish I could euthenize him at home because then he wouldn't have to have that scary trip to the vet and he could go out of the world when he's happy and content. I wonder if there are any vets that still make house calls?
Oh Major, I'm going to miss you - you're my big, fluff butt, my flirty cat.
P.S. I am happy today because I've finally found a food that he likes and seems to get down OK. He's eaten almost a whole can of Fancy Feast today and is acting perkier!
That's good news!

And I think Major was very lucky to have been able to spend his life in your care.
--
I also think that you, Joe and others are very lucky to have vets that give you all of your options without judgment.
I can relate to what you are going though with Major. While I also agree with what quixiotecoyote said above:
quixotecoyote said:
Some I'd rather keep around for entertainment and companionship than eat, but I don't see any fundamental difference.
I agree that all domesticated animals exist because we want them to exist and they do so at essentially with what is our pleasure.
But even so, I think there is are differences between animals kept for companionship and animals kept strictly for utility. But the main difference probably comes down to that while most of us can probably kid ourselves that the latter are no smarter than a block of wood, we can't with the former. Over time pets develop a trust in their owners. Sometimes its very easy to live up to that trust: especially at mealtimes and playtimes. Managing the end of their lives or possible end of their lives ... it's not so easy.
The weird thing about Breamy is that I think he can make the connection between my actions and his feeling better. (He's been sick other times also.) My presumption about his awareness adds to the difficulty of making the tough decisons on how to handle this time. In human beings, sentience is part of the rationale as to why we are entitled to rights and privileges. Lack of money in most western countries does not necc. mean premature death for us. But resources are not infinite, and the same obviously doesn't hold true for animals regardless of how aware they are.
Money is also a big issue to me at this time. If it wasn't, I would expect Breamy to be in pain until we we escalated up to a procedure that would work. Then, quite frankly, the odds for his having a good quality of life would have been not bad, and if the operations hadn't been a success he could have been euthanized after we tried all other options.
I don't regret my past decisions that has led to the side effect that money is not as plentiful for me now as it was in the past. Based on the information I had at each past juncture, I would have made the same ones again. But its a really tough break for Breamy. He would have had more chances. As it is, I did decide to pay for one catheterization for him (and its expensive in NYC), but to take no further surgical interventions. Hopefully it will work. Its touch and go for him right now, but I'm hoping that he turned the corner earlier this evening. I had spoken to the vet and she said he may not be as uncomfortable as I think he is, that I may be misinterpreting his reaction to some of his medications. I'm not going to take any irrevocable steps until he sees a vet at least one more time, and I'm hoping that I won't have to.