In this study, we propose machine learning (ML) for risk factors analysis and survival prediction of Heart Failure (HF) patients using a survival dataset. Five supervised ML methods are applied to the dataset: Decision Tree (DT), Decision Tree Regressor (DTR), Random Forest (RF), XGBoost, and Gradient Boosting (GB) algorithms. We compare the applied algorithms’ performances based on accuracy, precision, recall, F-measure, and log loss value and show RF provides the highest accuracy of 97.78%. The analysis of the risk factors shows the most predictive features based on coefficients and feature importance. The top six risk factors for HF patients are serum creatinine (SC), age, ejection fraction (EF), platelets, creatinine phosphokinase (CPK), and SS (SS). Further analysis of these factors shows significant clustering of the features. The survival analysis finds that the increment of SC, age, and SS and the decrement of EF are the most significant risk factors for HF patients. Our results suggest that HF survival prediction is possible with higher accuracy using the proposed model. Our ML models are useful in clinical settings for screening patients with HF probability.