I would suggest you read the book "An introduction to the Theory of Infinite Series" by Thomas Bromwich.
P.S.: There is a tale that goes something like Ramanujan was advised by British Mathematicians to read this book when he wanted to prove that the sum of a series of positive terms is negative ( I neither remember the series, nor Ramanujan's "sum" but all I could remember is it was divergent").
An online version, downloadable in many different formats, is here on the archive.com .
Read Comment below by Sivaram where he points out both the series and the sum!
Wolfram is more elegant:
$$ \sum_{n=0}^\infty \frac{n}{n^3+1} = -3^{-1}\sum_{\{\omega \in \mathbb{C}| \omega^3 +1 =0\}} \psi (-\omega)\omega^{-1} $$
where
$$\{\omega \in \mathbb{C}| \omega^3 +1 =0\} =\{-1, 1/2+i\sqrt{3}/2, 1/2-i\sqrt{3}/2 \}$$
Also: $$ \psi(z) -\psi(1-z) = - \pi \cot (\pi z) $$
and
$$ \psi(1+z) -\psi(z) = 1/z $$
More digamma function properties on wiki.
Residues (Wolfram again) are: $-1/3$ at $-1$, $(-i+\sqrt{3})/(3(i+\sqrt{3}))$ at $1/2+i\sqrt{3}/2$, and $(i+\sqrt{3})/(3(-i+\sqrt{3}))$ at $1/2-i\sqrt{3}/2$.
It turns out that:
$$ \cot (\pi(1/2+i\sqrt{3}/2)) = -i\tanh(\sqrt{3}\pi/2)$$
and
$$ \cot (\pi(1/2-i\sqrt{3}/2)) = i\tanh(\sqrt{3}\pi/2)$$
So:
$$ (-i+\sqrt{3})/(3(i+\sqrt{3}))\cdot [-i\tanh(\sqrt{3}\pi/2)]
+ (i+\sqrt{3})/(3(-i+\sqrt{3})) \cdot [i\tanh(\sqrt{3}\pi/2)]$$
$$ =-\tanh(\sqrt{3}\pi/2) /\sqrt{3}\ $$
Edit: I'm not sure how we ended up multiplying residues of $f$ at poles and $\cot$ at those poles (times $\pi$). From proofwiki (Marsden and Hoffman book), we need:
$$-\pi \sum_{z_0 {\rm \; pole \; of} \; f(z)} {\rm Res}(\cot (\pi z)f (z), z_0)$$
In any case, this is necessary to deal with pole $-1$ and $f(z)=z/(z^3+1)$:
$${\rm Res}(\cot (\pi z)f (z), -1) = 0 $$
Best Answer
The Herglotz trick is basically to define $$f(x):=\pi\cot\pi x,\quad g(x):=\lim_{N\to\infty}\sum_{n=-N}^N \frac{1}{x+n}$$ and derive enough common properties of these functions to see in the end that they must coincide. Namely, it consists of showing that:
Now the "trick" is to use all these properties as follows. Since $h$ is a periodic continuous function, it possesses a maximum $m$. Let $x_0$ be a point in $[0,1]$ with $h(x_0)=m$. It follows from (4) that $$h\left(\frac{x_0}{2}\right)+h\left(\frac{x_0+1}{2}\right)=2m,$$ and hence that $h(\frac{x_0}{2})=m$. Iteration gives $h(\frac{x_0}{2^n})=m$ for all $n$, and hence $h(0)=m$ by continuity. But $h(0)=0$, and so $m=0$, that is, $h(x)\leq 0$ for all $x\in\mathbb{R}$. As $h(x)$ is an odd function, $h(x)<0$ is impossible, hence $h(x)=0$ for all $x\in\mathbb{R}$.