An esophagectomy is generally recommended when esophageal cancer is detected early enough for surgical intervention to be beneficial. It is often part of a broader treatment plan that may include chemotherapy and radiation therapy. The surgery is typically considered when less invasive treatments are not sufficient to remove the cancer.