# How to evaluate $\frac{h}{x^2+h^2}+\sum_{k=1}^{\infty}h\left(\frac{1}{\left(2kd+x\right)^2+h^2}+\frac{1}{\left(2kd-x\right)^2+h^2}\right)$?

I'm curios as to what method(s) could be used for evaluating the series $$S=\frac{h}{x^2+h^2}+\sum_{k=1}^{\infty}h\left(\frac{1}{\left(2kd+x\right)^2+h^2}+\frac{1}{\left(2kd-x\right)^2+h^2}\right)?$$

From Mathematica, I know that the answer is

$$S=\frac{\pi}{4d}\left( \coth\left[\frac{\pi \left(h+ix\right)}{2d}\right]+ \coth\left[\frac{\pi \left(h-ix\right)}{2d}\right]\right),$$

but the result baffled me so much that I wanted to know more about how to arrive at this by hand.

Elementary approaches (which I would have a higher chance of understanding), if they are applicable, would be preferred, but any method is welcomed! :)

Thanks!

From Closed form for $\sum_{n=-\infty}^{\infty}\frac{1}{(n-a)^2+b^2}$., we have \begin{eqnarray} S&=&\frac{h}{x^2+h^2}+\sum_{k=1}^{\infty}h\left(\frac{1}{\left(2kd+x\right)^2+h^2}+\frac{1}{\left(2kd-x\right)^2+h^2}\right)\\ &=&\frac{h}{x^2+h^2}+\frac{h}{4d^2}\sum_{k=1}^{\infty}\left(\frac{1}{\left(k+\frac{x}{2d}\right)^2+(\frac{h}{2d})^2}+\frac{1}{\left(k-\frac{x}{2d}\right)^2+(\frac{h}{2d})^2}\right)\\ &=&\frac{h}{4d^2}\sum_{k=-\infty}^{\infty}\frac{1}{\left(k+\frac{x}{2d}\right)^2+(\frac{h}{2d})^2}\\ &=&\frac{h}{4d^2}\frac{\pi\sinh(\frac{\pi h}{d})}{\frac{h}{2d}(\cosh(\frac{\pi h}{d})-\cos(\frac{\pi x}{d}))}\\ &=&\frac{\pi}{2d}\frac{\sinh(\frac{\pi h}{d})}{\cosh(\frac{\pi h}{d})-\cos(\frac{\pi x}{d})}. \end{eqnarray}
Equation $(7)$ from this answer says that the principal value sum $$\sum_{k\in\mathbb{Z}}\frac1{k+z}=\pi \cot(\pi z)\tag{1}$$ holds for all $z\in\mathbb{C}$. From this we get \begin{align} \sum_{k\in\mathbb{Z}}\frac{y}{(k+x)^2+y^2} &=\frac1{2i}\sum_{k\in\mathbb{Z}}\left(\frac1{k+x-iy}-\frac1{k+x+iy}\right)\\ &=\frac\pi{2i}\left(\vphantom{\frac\pi{2i}}\cot(\pi(x-iy))-\cot(\pi(x+iy))\right)\\ &=\frac\pi{2i}\left(\frac{\cos(\pi(x-iy))}{\sin(\pi(x-iy))}-\frac{\cos(\pi(x+iy))}{\sin(\pi(x+iy))}\right)\\ &=\frac{\pi\sinh(2\pi y)}{\cosh(2\pi y)-\cos(2\pi x)}\tag{2} \end{align} using $\sin(a-b)=\sin(a)\cos(b)-\cos(a)\sin(b)$ and $\sin(a)\sin(b)=\cos(a-b)-\cos(a+b)$, as well as $\sin(ia)=i\sinh(a)$ and $\cos(ia)=\cosh(a)$.
Your formula can be written as \begin{align} \sum_{k\in\mathbb{Z}}\frac{h}{\left(2kd+x\right)^2+h^2} &=\frac1{2d}\sum_{k\in\mathbb{Z}}\frac{\frac{h}{2d}}{\left(k+\frac{x}{2d}\right)^2+\left(\frac{h}{2d}\right)^2}\\ &=\bbox[5px,border:2px solid #C0A000]{\frac\pi{2d}\frac{\sinh\left(\frac{\pi h}d\right)}{\cosh\left(\frac{\pi h}d\right)-\cos\left(\frac{\pi x}d\right)}}\tag{3} \end{align}