Energy Detection Algorithm Uncertainty
I'm wondering after finding the magnitude squared values at each FFT bin, do you then add each bin value up and divide by the number of bins (N) to get the average power? 


Yes.


  And also, do you just repeat this averaging M times? 


Yes, you would have to...


  And why exactly do you repeat this averaging M times??


...to reduce the impact of noise on your measurement and also, depending on the length of the FFT, to make sure that you have captured the whole dynamics of your signal.

For more information, please see Power Spectrum Estimation Using the FFT.

Hope this helps.