I don't understand how the following is equivalent.

is the average of all So,

Could someone walk me through this. I've been staring at it for a long while now. I'll try to show my confusion below:

So, expanding the left side I get

Then substituting for , I get

Then multiplying it out, I get

And I'll stop there, because I really don't know what taking the summation of a summation means???

But, I do think I'm not too far off track because I now see the first term from the right hand side of the initial equality.