How do I know whether to have surgery?

Depends. Depends on type of surgery, risks of surgery, your other medical issues, and your options. If youre not sure, get another opinion.
Be more specific. If you want a real answer. You need to give your symptoms or diagnosis and some idea of what you've already been told. That said, your surgeon should discuss the indications for surgery, alternative treatments to surgery, and the possible risks and benefits of surgery. Then you and your support system have to make the final decision as to whether to proceed with surgery. Good luck!