This work studies and optimizes the performance of reconfigurable intelligent surface (RIS)-aided networks in Nakagami- m fading environment. First, accurate closed-form approximations for the channel distributions are derived. Then, closed-form formulas for the system outage probability, average symbol error probability (ASEP), and the channel capacity are obtained. Furthermore, we provide three different optimization approaches for finding the optimum number of reflecting elements to achieve a target outage probability. At the high signal-to-noise ratio (SNR) regime, a closed-form expression for the asymptotic outage probability is obtained to give more insights into the system performance. Results show that the considered system can achieve a diversity order of, where a is a function of the Nakagami- m fading parameter m and the number of reflecting elements N . Moreover, findings show that m is more influential on the diversity order than N . Finally, the achieved expressions are applicable to non-integer values of m and any number of meta-surface elements N .