Closed formula for this sum $\sum^\infty_{n=0}\frac{1}{n^4+n^2+1}.$ How to calculate this sum $$\sum^\infty_{n=0}\frac{1}{n^4+n^2+1}.$$
Thank you in advance
 A: $\newcommand{\Ga}{\Gamma}$Martin Sleziak gave references to several answers to this question. All of those answers seem to involve complex analysis.
Here is how this sum can be evaluated (almost) without complex analysis: Using partial fraction decomposition, as e.g. in this answer, we reduce the problem to that of finding two sums of the form
\begin{equation}
    s:=\sum_{n=0}^\infty\Big(\frac1{n+a}-\frac1{n+b}\Big)
\end{equation}
for certain complex $a$ and $b$ not in the set $\{0,-1,-2,\dots\}$.
We have
\begin{equation}
\begin{aligned}
    s&=\sum_{n=0}^\infty\int_0^1 dx\,(x^{n+a-1}-x^{n+b-1}) \\ 
     &=\int_0^1 dx\,\sum_{n=0}^\infty(x^{n+a-1}-x^{n+b-1}) \\ 
     &=\int_0^1 dx\,\frac{x^{a-1}-x^{b-1}}{1-x}=\lim_{h\downarrow0}I(h), 
\end{aligned}
\end{equation}
where
\begin{equation}
\begin{aligned}
I(h)&:=\int_0^1 dx\,\frac{x^{a-1}-x^{b-1}}{(1-x)^{1-h}} \\ 
&=\frac{\Ga(a)\Ga(h)}{\Ga(a+h)}-\frac{\Ga(b)\Ga(h)}{\Ga(b+h)} \\ 
&=\frac{\Ga(a)\Ga(b+h)-\Ga(b)\Ga(a+h)}{h}\,\frac{\Ga(1+h)}{\Ga(a+h)\Ga(b+h)} \\ 
&\to\frac{\Ga(a)\Ga'(b)-\Ga(b)\Ga'(a)}{\Ga(a)\Ga(b)}
\end{aligned}
\end{equation}
as $h\downarrow0$, by l'Hospital's rule.
So,
\begin{equation}
    \sum_{n=0}^\infty\Big(\frac1{n+a}-\frac1{n+b}\Big)
    =\frac{\Ga(a)\Ga'(b)-\Ga(b)\Ga'(a)}{\Ga(a)\Ga(b)}
    =\psi(b)-\psi(a), 
\end{equation}
where $\psi:=\Ga'/\Ga$ is the digamma function.

Another elementary way to find the sum is as follows: For natural $N$,
\begin{equation}
\begin{aligned}
\sum_{n=0}^{N-1}\frac1{n+a}&=\frac d{da}\sum_{n=0}^{N-1}\ln(n+a) \\ 
&=\frac d{da}\ln\prod_{n=0}^{N-1}(n+a) \\ 
&=\frac d{da}\ln\frac{\Ga(N+a)}{\Ga(a)}=\psi(N+a)-\psi(a).  
\end{aligned}
\end{equation}
So,
\begin{equation}
\begin{aligned}
&\sum_{n=0}^\infty\Big(\frac1{n+a}-\frac1{n+b}\Big) \\ 
&=\lim_{N\to\infty}\Big(\sum_{n=0}^{N-1}\frac1{n+a}-\sum_{n=0}^{N-1}\frac1{n+b}\Big) \\ 
&=\psi(b)-\psi(a)+\lim_{N\to\infty}(\psi(N+a)-\psi(N+b)) \\ 
&=\psi(b)-\psi(a).  
\end{aligned}
\end{equation}
A: This is a special case of the following formula: let $R$ be a rational function with no poles at integers, and $R(\infty)=0$ or order at least $2$. Then
$$\sum_{n=-\infty}^\infty R(n)=-\sum_a\mathrm{res}_a\left(R(z)\pi\cot\pi z\right),$$
where summation in the RHS is over poles of $R$, so the sum is finite. This is obtained by integrating $\pi R(z)\cot\pi z$ over the squares $\{ z:\Re a=\pm (n+1/2),\Im z=\pm (n+1/2)\}$, and letting $n\to\infty$. Evident modifications can be made when $R$ has some
poles at integers.
