I’m running into problems with a summation
$$\langle p \rangle = \frac{\sum_{p=0}^{N-1}px^p}{\sum_{p=0}^{N-1}x^p} = x\frac{d}{dx}ln(\sum_{p=0}^{N-1}x^p)$$
I know I’ve seen this before but I can’t remember the justification to get it summed to
$$\frac{Nx^N}{x^N-1}-\frac{x}{x-1}$$
Any help greatly appreciated