Evaluate $\frac{q}{1+q^2}+\frac{q^2}{1+q^4}+\frac{q^3}{1+q^6}$, where $q^7=1$ and $q\neq 1$. 
Let $q$ be a complex number such that $q^7=1$ and $q\neq 1$. Evaluate $$\frac{q}{1+q^2}+\frac{q^2}{1+q^4}+\frac{q^3}{1+q^6}.$$
  The given answer is $\frac{3}{2}$ or $-2$. But my answer is $\pm 2$.

At first, I tried to evaluate it directly. And the LHS equals to
\begin{align}
\frac{q}{1+q^2}+\frac{q^2}{1+q^4}+\frac{q^3}{1+q^6} 
 & = \frac{q}{1+q^2}+\frac{q^2}{1+q^4}\cdot\frac{q^3}{q^3}+\frac{q^3}{1+q^6}\cdot\frac{q}{q} \\
 & = \frac{q}{1+q^2}+\frac{q^5}{1+q^3}+\frac{q^4}{1+q} \\
 & = q\cdot\frac{(1+q)(1+q^3)+q^4(1+q)(1+q^2)+q^3(1+q^2)(1+q^3)}{(1+q)(1+q^2)(1+q^3)} \\ 
 & = q\cdot\frac{1+q+q^3+q^4+q^4+q^5+q^6+1+q^3+q^5+q^6+q}{(1+q)(1+q^2)(1+q^3)} \\
 & = \frac{-2q^3}{(1+q)(1+q^2)(1+q^3)} \\ 
\end{align}
And 
$$(x-q)(x-q^2)(x-q^3)(x-q^4)(x-q^5)(x-q^6)=x^6+x^5+x^4+x^3+x^2+x+1$$
Let $x=-1$ I get that
$$(1+q)(1+q^2)(1+q^3)(1+q^4)(1+q^5)(1+q^6)=1$$
and
$$(1+q)(1+q^2)(1+q^3)\cdot q^4(q^3+1)\cdot q^5(q^2+1)\cdot q^6(q+1)=1$$
therefore
$$\left[(1+q)(1+q^2)(1+q^3)\right]^2=\frac{1}{q^{15}}=\frac{1}{q}$$
hence
$$\left[\frac{-2q^3}{(1+q)(1+q^2)(1+q^3)}\right]^2=\frac{q}{1}\cdot 4q^6=4$$
$$\frac{-2q^3}{(1+q)(1+q^2)(1+q^3)}=\pm 2$$
And I try for a solution as a polar-form method$.\\$Suppose $q=\cos\frac{2j\pi}{7}+i\sin\frac{2j\pi}{7}$
$$\frac{q^k}{1+q^{2k}}=\frac{\cos\frac{2jk\pi}{7}+i\sin\frac{2jk\pi}{7}}{2\cos\frac{2jk\pi}{7}\left(\cos\frac{2jk\pi}{7}+i\sin\frac{2jk\pi}{7}\right)}=\frac{1}{2\cos\frac{2jk\pi}{7}}$$
Am I going to the right direction? How I finish it? And please help to figure out what's wrong with my calculation at the first part. I appreciate for your help.
 A: We have that $q$ is a root of
$$
X^6 +X^5+\dots +X+1=X^3(X^3+X^{-3} +X^{2}+X^{-2}+ X+X^{-1}+1).
$$
Hence $q+q^{-1}$ is a root of
$$
Y^3 - 3Y +Y^2 -2 +Y +1= Y^3+Y^2-2Y-1.
$$
Hence $\frac{1}{q+q^{-1}}$ is a root of 
$$
Z^3+2Z-Z-1.
$$
Exactly the same is true for the roots $q^2, q^4$, so we get that the sum of the three roots 
$$\frac{1}{q+q^{-1}}+\frac{1}{q^2+q^{-2}}+\frac{1}{q^4+q^{-4}}=-2.$$
The left hand side is equal to the expression we are to evaluate. 
A: Let $7x=2k\pi$ where $k=\pm1,\pm2,\pm3$
like Prove that $\cos(\pi/7)$ is root of equation $8x^3-4x^2-4x+1=0$
$q_k=2\cos\dfrac{2k\pi}7; k=1,2,3$ are the roots of $$c^3+c^2-2c-1=0$$ 
Use Veita's formula $$\sum_{k=1}^3\dfrac1{q_k}=\dfrac{q_1q_2+q_2q_3+q_3q_1}{q_1q_2q_3}=\dfrac{-\dfrac21}{\dfrac11}$$
A: Suppose that $x_1,x_2,\ldots,x_{n-1}$ are the roots of $z^{n-1}+z^{n-2}+\ldots+z+1=0$.  We have
$$\frac{1}{x_j+x_j^{-1}}=\frac{x_j}{1+x_j^2}.$$
If $n$ is odd, then
$$1+z^{2n}=(1+z^2)(1-z^2+z^4-z^6+\ldots+z^{2(n-1)}).$$
Because $x_j^n=1$, we have
$$\frac{1}{1+x_j^2}=\frac{\sum_{k=0}^{n-1}(-1)^kx_j^{2k}}{1+x_j^{2n}}=\frac{\sum_{k=0}^{n-1}(-1)^kx_j^{2k}}{2}$$
so
$$\frac{x_j}{1+x_j^2}=\frac{1}{2}\sum_{k=0}^{n-1}(-1)^kx_j^{2k+1}.$$
Note that $\sum_{j=1}^{n-1}x_j^d=-1$ unless $d$ is a multiple of $n$, in which case $\sum_{j=1}^{n-1}x_j^d=n-1$.  Therefore
\begin{align}\sum_{j=1}^{n-1}\frac{x_j}{1+x_j^2}&=\frac{1}{2}\sum_{j=1}^{n-1}\sum_{k=0}^{n-1}(-1)^kx_j^{2k+1}\\&=\frac{1}{2}\sum_{k=0}^{n-1}(-1)^k\sum_{j=1}^{n-1}x_j^{2k+1}=\frac{1}{2}\left((-1)^{\frac{n-1}{2}}n-1\right).\end{align}
If $n\equiv 2\pmod4$, then
$$1+z^n=(1+z^2)(1-z^2+z^4-z^6+\ldots+z^{n-2}).$$
Because $x_j^n=1$, we have
$$\frac{1}{1+x_j^2}=\frac{\sum_{k=0}^{\frac{n}{2}-1}(-1)^kx_j^{2k}}{1+x_j^{n}}=\frac{\sum_{k=0}^{\frac{n}{2}-1}(-1)^kx_j^{2k}}{2}$$
so\begin{align}\sum_{j=1}^{n-1}\frac{x_j}{1+x_j^2}&=\frac{1}{2}\sum_{j=1}^{n-1}\sum_{k=0}^{\frac{n}{2}-1}(-1)^kx_j^{2k+1}\\&=\frac{1}{2}\sum_{k=0}^{\frac{n}{2}-1}(-1)^k\sum_{j=1}^{n-1}x_j^{2k+1}=-\frac{1}{2}.\end{align}
(Alternatively, note that $\sec\theta+\sec(\pi+\theta)=0$ and $\pi$ is an integer multiple of $\frac{2\pi}{n}$.)  If $n\equiv0\pmod{4}$, then clearly $\sum_{j=1}^{n-1}\frac{x_j}{1+x_j^2}$ is not defined.
Therefore, we have
$$\sum_{j=1}^{n-1}\sec\frac{2\pi j}{n}=2\sum_{j=1}^{n-1}\frac{x_j}{1+x_j^2}=\left\{\begin{array}{ll}
(-1)^{\frac{n-1}{2}}n-1&\text{if $n\equiv1\pmod{2}$},\\
-1&\text{if $n\equiv 2\pmod{4}$},\\
\text{undefined}&\text{if $n\equiv 0\pmod{4}$}.
\end{array}\right.$$
The sum in question is equal to
$$\frac{1}{4}\sum_{j=1}^6\sec\frac{2\pi j}{7}=\frac{(-1)^{\frac{7-1}{2}}\cdot 7-1}{4}=-2.$$
A: You may continue with
$
\frac{q^k}{1+q^{2k}}= \frac{1}{2\cos k\alpha} 
  $, where $\alpha=\frac{2\pi j}7,\>j=1,2,...,6$, and write the expression as,
$$\frac{q}{1+q^2}+\frac{q^2}{1+q^4}+\frac{q^3}{1+q^6}
=\frac{\cos\alpha+ \cos2\alpha+ \cos3\alpha}{2\cos\alpha\cos2\alpha\cos3\alpha}=\frac ND\tag1\\$$
where we used $2\cos x\cos y=\cos(x+y)+\cos(x-y)$ and $\cos 4\alpha= \cos 3\alpha$, $\cos 5\alpha= \cos 2\alpha$. For the denominator, apply  $\sin 2x = 2\sin x \cos x$,
$$ 4\sin\alpha \cdot D =4 \sin 2\alpha\cos 2\alpha\cos 3\alpha=2 \sin 4\alpha\cos 4\alpha= \sin 8\alpha= \sin\alpha\tag2 $$ 
For the numerator, use $2\sin x\cos y=\sin(x+y)+\sin(x-y)$ and $\sin 3\alpha= -\sin 4\alpha$,
\begin{align}2\sin\alpha \cdot N &=2\sin \alpha\cos\alpha+ 2\sin \alpha\cos2\alpha+ 2\sin \alpha\cos3\alpha\\
&= \sin 2\alpha+ (\sin 3\alpha- \sin \alpha) + (\sin 4\alpha- \sin 2\alpha)= -\sin \alpha\tag3\\
\end{align}
From (2) and (3), we have $D=\frac14$ and $N = -\frac12$. Plug into (1) to obtain
$$\frac{q}{1+q^2}+\frac{q^2}{1+q^4}+\frac{q^3}{1+q^6} =-2$$
