I'm trying to take the partial derivative of $-\sum\limits_{i=1}^n \frac{(x_i-\mu)^2}{2\sigma^2}$ with respect to $\mu$. The correct answer is $\sum\limits_{i=1}^n \frac{x_i-\mu}{\sigma^2}$. It looks like some u-substitution work where $u = x_i-\mu$ and $du = -1$ so it's $\sum\limits_{i=1}^n \frac{u^2}{2\sigma^2}du$ which ends up being $\sum\limits_{i=1}^n\frac{2(x_i-\mu)}{2\sigma^2} \times (-1)$
it all cancels out but why does this still work when inside of a summation?
Usually when I do derivatives of summations, I have to incorporate the $n$ into the equation to rid myself of the summation operator. For example, $$\prod\limits_{i=1}^n \frac{1}{\sqrt{2\pi\sigma^2}} = \bigg(\frac{1}{\sqrt{2\pi\sigma^2}}\bigg)^n$$
The summation operator throws me off when it involves derivatives and the only way it makes sense to me is to restructure the format so that it doesn't include the summation operator. How can this be reorganized so the derivative makes sense?