$\sum_{k=0}^{n-1}\frac{1}{1-2x\cos\frac{2k\pi}{n}+x^2}$ 
Given it is to prove this $\sum_{k=0}^{n-1}\frac{1}{1-2x\cos\frac{2k\pi}{n}+x^2}=\frac{n(1+x^n)}{(1-x^n)(1-x^2)}$

For this i first tried substituting and using complex numbers like this but what after this if someone have any other method to proceed his welcome.
$A_k=1-2x\cos\frac{2k\pi}{n}+x^2=(x-\cos\frac{2k\pi}{n})^2-(i\sin\frac{2k\pi}{n})^2$ and then seperating this.$=(x-\cos\frac{2k\pi}{n}+i\sin\frac{2k\pi}{n})(x-\cos\frac{2k\pi}{n}-i\sin\frac{2k\pi}{n})$
 A: Let $\omega=e^{\frac{2\pi i}n}$ be the primitive $n$-th root of unity. We have for all $|x|<1$,
$$\begin{align*}
\frac{1-x^2}{1-2x\cos(\frac{2k\pi}{n})+x^2}&=\frac{\bar\omega^k(\omega^k-x)+x(\bar\omega^k-x)}{(\omega^k-x)(\bar\omega^k-x)}\\&=\frac{\bar\omega^k}{\bar\omega^k-{x}}+\frac{x}{\omega^k-x}\\&=\sum_{i=0}^\infty \left(\frac x {\bar\omega^k}\right)^i-1+\sum_{i=0}^\infty \left(\frac x {\omega^k}\right)^i\\&=-1+\sum_{i=0}^\infty (\omega^{ki}+\bar\omega^{ki})x^i.
\end{align*}$$ Using the identity $\sum_{k=0}^{n-1}\omega^{jk}=\sum_{k=0}^{n-1}e^{\frac{2\pi jk i}{n}}=n\mathbf 1_{j\in n\Bbb Z}$, we find for all $|x|<1$,
$$\begin{align*}
(1-x^2)\sum_{k=0}^{n-1}\frac{1}{1-2x\cos(\frac{2k\pi}{n})+x^2}&=-n+\sum_{i=0}^\infty x_i\left(\sum_{k=0}^{n-1}\omega^{ki}+\bar\omega^{ki}\right)\\&=-n+2n\sum_{i=0}^\infty x^i\mathbf 1_{i\in n\Bbb Z}\\&=n\left(-1+2\sum_{i=0}^\infty x^{ni}\right)\\&=n\left(-1+\frac{2}{1-x^n}\right)\\&=\frac{n(1+x^n)}{1-x^n}.
\end{align*}$$ This gives
$$
\sum_{k=0}^{n-1}\frac{1}{1-2x\cos(\frac{2k\pi}{n})+x^2}=\frac{n(1+x^n)}{(1-x^n)(1-x^2)}
$$ for all $|x|<1$. However, since both are meromorphic functions defined on an open connected domain, identity theorem implies they are equal where they are defined.
