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.

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.$$
