It really depends a lot on the situation.
There are three factors to consider:
The chance of death without surgery.
The chance of death from the illness after a surgery. (in a case where the surgery is ineffective)
The chance of death from a surgery itself.
The national (US) death rate from surgeries is 1.14%. People tend to overestimate this rate, but it is actually very small compared to most things. Depending on the surgery, this rate may be more or less.
For example, let’s say that you have cancer, and there is a 50% chance of death within a few months. There is a surgery available that will reduce the risk of death to 10%. In addition, there is a 5% chance of death due to the surgery itself. Is this worth the risk?
(100% – 5%) * (100% – 10%) > (100% – 50%)
0.855 > 0.5, so the surgery is worth the risk
Now, the above depends on the fact that the surgery is related to saving your life. If the surgery is cosmetic, then you have to factor in abstract concepts such as quality of life.