This survey investigates the integration of artificial intelligence (AI) with reconfigurable intelligent surfaces (RISs), emphasizing its pivotal role in advancing wireless communications. Initially, it provides an overview of RIS variants-passive, active, and hybrid-and the evolution to beyond diagonal RIS (BD-RIS), detailing their architectures, operational modes, benefits, and challenges. The focus then shifts to various AI algorithms applied within the RIS context, including supervised, unsupervised, deep learning (DL), reinforcement learning (RL), deep reinforcement learning (DRL), federated learning (FL), graph learning (GL), transfer learning (TL), meta-learning techniques. We explore how AI enhances RIS functionality in wireless networks, optimizing key aspects such as channel estimation (CE), rate maximization, expanding coverage, energy efficiency (EE), and enhancing security within RIS-based networks. Additionally, the survey conducts a thorough performance analysis of these AI-enhanced RIS systems under different networks. Comprehensive summary tables are provided to elucidate system models, channel state information, AI algorithms, and optimization strategies. The survey concludes by synthesizing the insights gained from AI in RIS applications, identifying current challenges, and suggesting directions for future research, thereby underscoring AI's substantial impact on the evolution of RISs and the 6G and beyond wireless networks.