An esophagectomy is a surgical procedure that involves the removal of all or part of the esophagus, the tube that carries food from the throat to the stomach. This operation is primarily performed to treat cancer of the esophagus, although it may also be used for severe cases of benign conditions like achalasia.