Las raíces de $x^6+x^5+\ldots+x+1$$\mathbb{C}$$x=\exp\left(\frac{2\pi\text{i}}{7}\right)$$k=1,2,\ldots,6$. Deje $y:=x+\frac{1}{x}$. A continuación, $$\frac{x^6+x^5+\ldots+x+1}{x^3}=\left(y^3-3y\right)+\left(y^2-2\right)+y+1=y^3+y^2-2y-1\,.$$
Por lo tanto, las raíces de $y^3+y^2-2y-1$$y=y_k:=2\,\cos\left(\frac{2k\pi}{7}\right)$$k=1,2,3$. Observar que $$S:=\sum_{k=1}^3\,\frac{1}{\cos^{2}\left(\frac{k\pi}{7}\right)}=\sum_{k=1}^3\,\frac{2}{1+\cos\left(\frac{2k\pi}{7}\right)}=4\,\sum_{k=1}^3\,\frac{1}{2+y_k}\,.$$
Desde $y_k^3+y_k^2-2y_k-1=0$, tenemos $$y_k^2-y_k=\frac{1}{2+y_k}$$ for all $k=1,2,3$. En consecuencia,
$$S=4\,\sum_{k=1}^3\,\left(y_k^2-y_k\right)\,.$$
El resto debe ser fácil.
En general, vamos a $n$ ser un entero no negativo y estamos evaluando las sumas $\displaystyle \sum_{k=0}^{2n}\,\frac{1}{\cos^{2}\left(\frac{k\pi}{2n+1}\right)}$$\displaystyle \sum_{k=1}^{n}\,\frac{1}{\cos^{2}\left(\frac{k\pi}{2n+1}\right)}$. Las raíces de $x^{2n+1}-1$$\mathbb{C}$$x=x_k:=\exp\left(\frac{2k\pi}{2n+1}\right)$$k=0,1,2,\ldots,2n$. Observar que
$$\frac{1}{1+x_k}=\frac{1}{2}\,\left(\frac{1+x_k^{2n+1}}{1+x_k}\right)=\frac{1}{2}\,\sum_{j=0}^{2n}\,(-1)^j\,x_k^j=\frac{2n+1}{2}-\frac{1}{2}\,\sum_{j=1}^{2n}\,\left(1-\left(-x_k\right)^j\right)\,.$$
Es decir,
$$\frac{1}{\left(1+x_k\right)^2}=\frac{2n+1}{2}\left(\frac{1}{1+x_k}\right)-\frac{1}{2}\,\sum_{j=1}^{2n}\,\sum_{i=0}^{j-1}\,(-1)^i\,x_k^i\,,$$
o, equivalentemente,
$$\frac{1}{\left(1+x_k\right)^2}=\frac{2n+1}{4}\,\sum_{j=0}^{2n}\,(-1)^j\,x_k^j-\frac{1}{2}\,\sum_{j=1}^{2n}\,\sum_{i=0}^{j-1}\,(-1)^i\,x_k^i\,.$$
En consecuencia,
$$\frac{x_k}{\left(1+x_k\right)^2}=\frac{2n+1}{4}\,\sum_{j=0}^{2n}\,(-1)^j\,x_k^{j+1}-\frac{1}{2}\,\sum_{j=1}^{2n}\,\sum_{i=0}^{j-1}\,(-1)^i\,x_k^{i+1}=\frac{2n+1}{4}+f\left(x_k\right)$$ for some polynomial $f(x)$ of degree at most $2n$ without the constant term. Then, $$\sum_{k=0}^{2n}\,\frac{x_k}{\left(1+x_k\right)^2}=\frac{(2n+1)^2}{4}+\sum_{k=1}^{2n}\,f\left(x_k\right)\,.$$
Es evidente que $\displaystyle\sum_{k=0}^{2n}\,f\left(x_k\right)=0$. Además, $$\frac{x_k}{\left(1+x_k\right)^2}=\frac{1}{2}\,\left(\frac{1}{1+\cos\left(\frac{2k\pi}{2n+1}\right)}\right)=\frac{1}{4}\,\left(\frac{1}{\cos^2\left(\frac{k\pi}{2n+1}\right)}\right)\,.$$ Ergo,
$$\frac{1}{4}\,\sum_{k=0}^{2n}\,\frac{1}{\cos^2\left(\frac{k\pi}{2n+1}\right)}=\sum_{k=0}^{2n}\,\frac{x_k}{\left(1+x_k\right)^2}=\frac{(2n+1)^2}{4}\,.$$ This shows that $$\sum_{k=0}^{2n}\,\frac{1}{\cos^2\left(\frac{k\pi}{2n+1}\right)}=(2n+1)^2\,.$$ Además, hemos
$$\sum_{k=1}^n\,\frac{1}{\cos^2\left(\frac{k\pi}{2n+1}\right)}=\frac{(2n+1)^2-1}{2}=2n(n+1)\,.$$