I. Introduction

II. Related Surveys

III. Background and Problem Formulations for Optimizing RIS-aided Wireless Networks

A. Fundamental Theories of RIS Technology

B. Sum-rate/Capacity Maximization

C. Power Minimization

D. Energy Efficiency Maximization

E. User Fairness Maximization

F. Secrecy Rate Maximization

G. Optimization with Integer Constraints: Discrete RIS Phase Shifts and Resource Allocation Problems

H. Discussions and Analyses

IV. Model-based Optimization Algorithms for RIS-aided Wireless Networks

A. Alternating Optimization

B. Block Coordinate Descent

C. Majorization-Minimization Method

D. Successive Convex Approximation

E. Semidefinite Relaxation

F. Second-order Cone Programming

G. Fractional Programming

H. Branch-and-Bound

I. Discussions and Numerical Results

V. Heuristic Optimization Approaches

A. Convex-Concave Procedure

B. Meta-heuristic Algorithms

C. Greedy Algorithms

D. Matching Theory-based Methods

E. Discussions and Numerical Results

VI. ML-enabled Optimization for RIS-aided Wireless Networks

A. Supervised Learning-enabled Optimization

B. Unsupervised Learning-based Optimization

C. Reinforcement Learning-based Optimization for Target Networks

D. Federated Learning and RISs

E. Graph Learning

F. Hierarchical Learning

G. Meta-Learning

H. Discussions and Numerical Results

VII. Comparison and Relationship between Model-based, Heuristic, and ML Approaches

B. Challenges and Future Directions

IX. Conclusion