Calculate the sum: $$\sum_{k=1}^{n} \frac{1}{1+k^2}$$
I'm supposed to calculate it without using functions like Gamma, Zeta, Digamma, etc...
What I tried:
$$\sum_{k=1}^{n} \frac{1}{1+k^2}=\sum_{k=1}^{n} \frac{1}{(k+i)(k-i)}=\frac{1}{2i}\sum_{k=1}^{n}\bigg( \frac{1}{k-i} - \frac{1}{k+i}\bigg)$$
The partial sums of $\sum_{k\geq 1}\frac{1}{k^2+1}$ have no simple closed form other than $\sum_{k=1}^{n}\frac{1}{1+k^2}$. On the other hand the value of the series can be computed in a rather elementary way. We may consider that for any $k\in\mathbb{N}^+$ $$ \frac{1}{k^2+1} = \int_{0}^{+\infty}\frac{\sin(kx)}{k}e^{-x}\,dx $$ holds by integration by parts. Since $$ \sum_{k\geq 1}\frac{\sin(kx)}{k} $$ is the $2\pi$-periodic extension of the function $w(x)$ which equals $\frac{\pi-x}{2}$ on $(0,2\pi)$, we have: $$ \sum_{k\geq 1}\frac{1}{k^2+1} = \int_{0}^{+\infty}w(x)e^{-x}\,dx = \sum_{m\geq 0}\int_{2m\pi}^{2(m+1)\pi}w(x)e^{-x}\,dx =\sum_{m\geq 0}e^{-2m\pi}\int_{0}^{2\pi}\frac{\pi-x}{2}e^{-x}\,dx.$$ By computing the very last integral it follows that $$ \sum_{k\geq 1}\frac{1}{k^2+1} = \left[\frac{\pi-1}{2}+\frac{\pi+1}{2}e^{-2\pi}\right]\sum_{m\geq 0}e^{-2m\pi}= \left[\frac{\pi-1}{2}+\frac{\pi+1}{2}e^{-2\pi}\right]\frac{e^{2\pi}}{e^{2\pi}-1}$$ or $$ \sum_{k\geq 1}\frac{1}{k^2+1} = \left[\pi\cosh(\pi)-\sinh(\pi)\right]\frac{1}{e^{\pi}-e^{-\pi}}=\color{red}{\frac{\pi}{2}\coth(\pi)-\frac{1}{2}}.$$