ObjectiveTo explore the risk factors for postoperative respiratory failure (RF) in patients with esophageal cancer, construct a predictive model based on least absolute shrinkage and selection operator (LASSO)-logistic regression, and visualize the constructed model. MethodsA retrospective analysis was conducted on patients with esophageal cancer who underwent surgical treatment in the Department of Thoracic Surgery, Sun Yat-sen University Cancer Center Gansu Hospital from 2020 to 2023. Patients were divided into a RF group and a non-RF (NRF) group according to whether RF occurred after surgery. Clinical data of the two groups were collected, and LASSO-logistic regression was used to optimize feature selection and construct the predictive model. The model was internally validated by repeated sampling 1000 times based on the Bootstrap method. ResultsA total of 217 patients were included, among which 24 were in the RF group, including 22 males and 2 females, with an average age of (63.33±9.10) years; 193 were in the NRF group, including 161 males and 32 females, with an average age of (62.14±8.44) years. LASSO-logistic regression analysis showed that the ratio of forced expiratory volume in one second/forced vital capacity (FEV1/FVC) to predicted value (FEV1/FVC%pred) [OR=0.944, 95%CI (0.897, 0.993), P=0.026], postoperative anastomotic fistula [OR=4.106, 95%CI (1.457, 11.575), P=0.008], and postoperative lung infection [OR=3.776, 95%CI (1.373, 10.388), P=0.010] were risk factors for postoperative RF in patients with esophageal cancer. Based on the above risk factors, a predictive model was constructed, with an area under the receiver operating characteristic curve of 0.819 [95%CI (0.737, 0.901)]. The Hosmer-Lemeshow test for the calibration curve showed that the model had good goodness of fit (P=0.527). The decision curve showed that the model had good clinical net benefit when the threshold probability was between 5% and 50%. Conclusion FEV1/FVC%pred, postoperative anastomotic fistula, and postoperative lung infection are risk factors for postoperative RF in patients with esophageal cancer. The predictive model constructed based on LASSO-logistic regression analysis is expected to help medical staff screen high-risk patients for early individualized intervention.