Um...Look at your code:
for (var i = 0; i < 101; i++){
square = Math.pow(i, 2);
square += square;
sum += i;
}
What value is in
square
after the loop?
Answer: 20,000
Why?
Because it only ever uses the final value to go round the loop: 100 - all other values are discarded the next time it goes round the loop.
And 100 * 100 * 2 == 20,000
You need to start using the debugger to work this kind of thing out, rather that asking other people!