<s>[INST] If $z^{23}=1$ then evaluate $\sum^{22}_{z=0}\frac{1}{1+z^r+z^{2r}}$ 
If $z$ is any complex number and $z^{23}=1$ then evaluate $\displaystyle \sum^{22}_{r=0}\frac{1}{1+z^r+z^{2r}}$

Try: From $$z^{23}-1=(z-1)(1+z+z^2+\cdots  +z^{22})$$
And our sum $$\sum^{22}_{r=0}\frac{1}{1+z^r+z^{2r}}=\frac{1}{3}+\frac{1}{1+z+z^2}+\frac{1}{1+z^2+z^4}+\cdots  +\frac{1}{1+z^{22}+z^{44}}$$
Now i did not understand how can i simplify it.
Could some help me. Thanks. 
 [/INST] Define $f(x)=\frac{1}{1+x+x^2}$. Then we have to calculate
$$
\sum_{k=0}^{22}f(z^k)=\frac{1}{3}+\sum_{k=1}^{22}f(z^k).
$$
Let's work out the polynomial expression for $f$ using $(a+b)(a-b)=a^2-b^2$.
$$
f(s)=\frac{s-1}{s^3-1}=\frac{(s-1)(s^3+1)}{s^6-1}=\frac{(s-1)(s^3+1)(s^6+1)}{s^{12}-1}=\frac{(s-1)(s^3+1)(s^6+1)(s^{12}+1)}{s^{24}-1}.
$$
Since $s^{24}=s$ for the $23$d roots of unity, we get
$$
f(z^k)=(z^{3k}+1)(z^{6k}+1)(z^{12k}+1)=1+z^{3k}+z^{6k}+z^{9k}+z^{12k}+z^{15k}+z^{18k}+z^{21k}.\tag{1}
$$
Now as the OP has noticed
$$
s^{23}-1=(s-1)(1+\underbrace{s+s^2+\ldots+s^{22}}_{\Phi(s)}).
$$
For the $z^k$, $k=1,2,\ldots,22$, it makes (as all those are primitive roots)
$$
0=\underbrace{(z^k-1)}_{\ne 0}(1+\Phi(z^k))\quad\Leftrightarrow\quad \Phi(z^k)=-1.
$$
Finally, summing up (1) we get
$$
\sum_{k=1}^{22}f(z^k)=22+\Phi(z^3)+\Phi(z^6)+\Phi(z^9)+\Phi(z^{12})+\Phi(z^{15})+\Phi(z^{18})+\Phi(z^{21})=22-7=15.
$$
Plus $\frac13$.
</s>