Thank you for your response.
I think I understand what's happening.
He adds the \[\sqrt{M}\] terms, because he associates MQAM with MPAM modulation, considering also all symbols equally likely to be transmitted, as you suggested.
Specifically, he views the M-QAM system as two separate M-PAM systems with signal constellations of size L=\[\sqrt{M}\], one transmitted over the in phase component and the other transmitted over the quadrature component.
Therefore, the square MQAM constellation equals \[\sqrt{M}\] \[\times\] \[\sqrt{M}\].
In order to calculate the average energy of the MQAM system, you calculate the energy of the separate MPAM systems.
So, for each component we add \[\sqrt{M}\] points, multiplying the sum by \[\sqrt{M}\],
because each dimension has \[\sqrt{M }\] series of points.
Finally, each component is divided by M, so as to find the average energy of the MQAM system.