Calculating the Spectral Centroid of a Signal Here is the equation:

$$C_i=\frac{\displaystyle \sum_{k=1}^{W_{f_L}}kX_i(k)}{\displaystyle\sum_{k=1}^{W_{f_L}}X_i(k)} $$

The MATLAB code for the equation is:

sum(m.*window) / sum(window);


Let's say length(window) = 882 that contains the first half (abs) of the magnitude spectrum, fs = 44100.

Now calculate m:

m = ( (fs/(2*window)) * [1:window] )';


The length(m) = 882 and increments in 25, which is the sample range (e.g. [25 50 75 100 ... 22050]).

I'm trying to determine a better insight in terms of what is happening when both terms are being divided.  It is clear that each element of m is multiplying each element of window, but what is actually happening?  The book I'm reading just states that the Spectral Centroid is the center of 'gravity' of the spectrum.
The function you wrote is basically like calculating the center of mass of a body or for that matter the Mean Value of a Distribution.

If you remember from Probability, the Mean is given by:

$$ E \left[ y \right] = \sum_i {y}_{i} p \left( {y}_{i} \right) $$

Now, let's think of the Frequency Function (The DFT) as a probability function.
In order to do so we'll normalize it to have a sum of 1.  

This is done by dividing each element by the sum of elements.
Then just apply the Mean operator to calculate the Mean of this "Distribution":

$$ {C}_{i} = \sum_{k} \underset{{y}_{i}}{\underbrace{k}} \underset{ p \left( {y}_{i} \right ) }{\underbrace{ \frac{{X}_{i} \left( k \right)}{\sum_{k} {X}_{i}
 \left( k \right) } }} $$

The result you'll get is exactly what you have written above.