$\sum_{k=1}^{2004}\frac{1}{1+\tan^{2}\left(\frac{k\pi}{2\cdot2005}\right)}$ So I've been working on this problem for a while and I was able to get up to here:
$$\sum_{k=1}^{2004}\cos^{2}\left(\frac{k\pi}{2\cdot2005}\right)$$
With the trigonometric identity that $1+\tan^2\left(\theta\right) = \sec^2\left(\theta\right)$. And that $\cos\left(\theta\right) = \frac{1}{\sec\left(\theta\right)}$.
I'm stuck at this point, does anyone have anything on how to move it forward?
Sidenote: I'm a precalculus student
 A: \begin{align}
\sum_{k=1}^{2004}\cos^{2}\left(\frac{k\pi}{2\cdot2005}\right)
& =\frac12 \sum_{k=1}^{2004}(1+ \cos\frac{k\pi}{2005})\\
& = \frac{2004}2+ \frac12 \sum_{k=1}^{1002}\left[\cos\frac{k\pi}{2005}
+ \cos\frac{(2005-k)\pi}{2005}\right]\\
& = 1002+ \frac12 \sum_{k=1}^{1002}0=1002\\
\end{align}
A: Now use the half-angle formula $$\cos^2 \frac{x}{2} = \frac{1 + \cos x}{2}.$$  This gives $$1002 + \frac{1}{2}\sum_{k=1}^{2004} \cos \frac{k\pi}{2005}.$$  Then recall Euler's formula $$e^{i\theta} = \cos \theta + i \sin \theta,$$ which then gives $$\cos \theta = \frac{e^{i\theta} + e^{-i\theta}}{2}.$$  This will give you a geometric series that you can sum.
A: Using the double angle formula for cosine and then replacing $k$ with $2005-k$ while using that $\cos(\pi-\theta)+\cos\theta =0 $ yields the sum. Another approach can to be use the formula for sum of series of cosine when angles are in arithmetic progression. 
$$\begin{aligned}\sum_{k=1}^{2004}\cos^2\left(\frac{k\pi}{2005}\right)&=\frac{1}{2}\sum_{k=1}^{2004}\left[1+\cos\left(\frac{k\pi}{2005}\right)\right]\\ & =\frac{1}{2}\sum_{k=1}^{2004}\left[1+\cos\left(\pi-\frac{k\pi}{2005}\right)\right]\end{aligned}$$
A: $$S=\sum_{k=1}^{n-1}\cos^2(\frac{k\pi}{2n})=\frac{1}{2}\sum_{k=1}^{n-1}(1+\cos(\frac{k\pi}{n}))$$
But with $\omega=e^{i\pi/n}$:
$$\sum_{k=1}^{n-1}\cos(\frac{k\pi}{n})=\Re\sum_{k=1}^{n-1}e^{i\frac{k\pi}{n}}=\Re\omega\frac{\omega^{n-1}-1}{\omega-1}=\Re\frac{(-1)^{n}-\omega}{\omega-1}=\Re\begin{Bmatrix}-1&,n=2k\\-i\tan(\frac{\pi}{4n}) &,n=2k+1\end{Bmatrix}$$
and thus, since $n=2005$
$$S=1002$$
