Agriculture is crucial for a country’s overall development, heavily impacting the national economy. In China’s modernization context, agricultural modernization plays a pivotal role by transforming traditional farming into modern agriculture through advances in mechanization, irrigation, and electrification. This study investigates the spatial and temporal patterns of rural residents’ income from 2005 to 2020. It explores the relationships between mechanization, irrigation, and electrification, and their impacts on residents’ livelihoods, including income and grain production from 2003 to 2023. Additionally, a ridge regression model is used to analyze developmental trends and factors that support rural residents’ livelihoods. Findings reveal significant variations in per capita income among rural residents across different provinces in China. The study highlights the importance of resource advantages, rural economic development, and government support. It also identifies a strengthening spatial clustering pattern in rural residents’ income over time. Moreover, a strong correlation is observed between income, grain production, and variables such as agricultural machinery power, effective irrigation area, and power generation capacity. Regression analysis confirms these relationships with an accuracy of over 0.95 (R2). This study employs statistical analysis and machine learning to explore and predict the impact of agricultural modernization on farmers’ livelihoods, providing insights into modern agricultural development. The results contribute to a better understanding of the complex dynamics between agricultural modernization, rural residents’ income, and related factors. Ultimately, this research aids in policy formulation and decision-making for national development.