Find the sum of $\sum \frac{1}{k^2 - a^2}$ when $0<a<1$

This question was settled in the Mathematics chatroom, but I'll put up the solution here for reference.

Starting with the infinite product

$$\frac{\sin\,\pi x}{\pi x}=\prod_{k=1}^\infty \left(1-\frac{x^2}{k^2}\right)$$

taking the logarithm of both sides gives

$$\log\left(\frac{\sin\,\pi x}{\pi x}\right)=\log\left(\prod_{k=1}^\infty \left(1-\frac{x^2}{k^2}\right)\right)=\sum_{k=1}^\infty \log\left(1-\frac{x^2}{k^2}\right)$$

Differentiation gives

$$\frac{\pi x}{\sin\,\pi x}\left(\frac{\cos\,\pi x}{x}-\frac{\sin\,\pi x}{\pi x^2}\right)=\sum_{k=1}^\infty \frac{-2x}{k^2\left(1-\frac{x^2}{k^2}\right)}$$

which simplifies to

$$\pi\cot\,\pi x-\frac1{x}=-2x\sum_{k=1}^\infty \frac1{k^2-x^2}$$

or

$$\sum_{k=1}^\infty \frac1{k^2-x^2}=\frac1{2x^2}-\frac{\pi\cot\,\pi x}{2x}$$


Let us consider the principal value of the conditionally convergent infinite harmonic series $$ \begin{align} f(z) &=\sum_{k=-\infty}^\infty\frac{1}{z+k}\\ &=\lim_{n\to\infty}\sum_{k=-n}^n\frac{1}{z+k}\tag{1a}\\ &=\lim_{n\to\infty}\frac1z+\sum_{k=1}^n\frac{1}{z-k}+\frac{1}{z+k}\tag{1b}\\ &=\frac1z+\sum_{k=1}^\infty\frac{2z}{z^2-k^2}\tag{1c} \end{align} $$ The series in $(1c)$ converges absolutely for all non-integer $z$.

Each of the terms in $(1c)$ is odd, so $f(-z)=-f(z)$.

The series in $(1a)$ shows that $f$ has a simple pole with residue $1$ at each integer.

$f$ has period $1$: $$ \begin{align} f(z+1)-f(z) &=\lim_{n\to\infty}\sum_{k=-n}^n\frac{1}{z+k+1}-\frac{1}{z+k}\\ &=\lim_{n\to\infty}\frac{1}{z+n+1}-\frac{1}{z-n}\\ &=0\tag{2} \end{align} $$ $f(1/2)=0$: $$ \begin{align} f(1/2) &=\lim_{n\to\infty}\sum_{k=-n}^n\frac{1}{k+1/2}\\ &=\lim_{n\to\infty}\frac{1}{n+1/2}\\ &=0\tag{3} \end{align} $$ Take the derivative of $f$: $$ f'(z)=\lim_{n\to\infty}\sum_{k=-n}^n\frac{-1}{(z+k)^2}\tag{4} $$ This series converges absolutely. and the terms monotonically go to $0$ as $|\Im(z)|\to\infty$.

Let's consider $if(iy)$ as $y\to\infty$. Using $(1c)$, we get $$ \begin{align} if(iy) &=\frac1y+\sum_{k=1}^\infty\frac{2y}{y^2+k^2}\\ &=\frac1y+\sum_{k=1}^\infty\frac{2/y}{1+(k/y)^2}\tag{5} \end{align} $$ As $y\to\infty$, the summation in $(5)$ is a Riemann sum for the integral $$ \int_0^\infty\frac{2\mathrm{d}x}{1+x^2}=\pi\tag{6} $$ Thus, $if(iy)\to\pi$ as $y\to\infty$ and $if(iy)\to-\pi$ as $y\to-\infty$.

Since $f$ has period $1$ and $f'(z)\to0$ as $|\Im(z)|\to\infty$, it is evident that $f(z)\to-i\pi$ as $\Im(z)\to\infty$ and $f(z)\to i\pi$ as $\Im(z)\to-\infty$. This means that $f$ is bounded when away from the real axis.

The functions $f$ and $\pi\cot(\pi z)$ have the same poles, with identical residues, and both are bounded when away from the real axis. Thus, their difference is bounded for all $z$. Since their difference is analytic and bounded, it must be constant. This difference is $0$ at $1/2$, so it must be $0$ everywhere. Therefore, the principal value of $$ \sum_{k=-\infty}^\infty\frac{1}{z+k}=\pi\cot(\pi z)\tag{7} $$ for all $z$.


Combining $(1c)$ and $(7)$ yields $$ \frac1z+\sum_{k=1}^\infty\frac{2z}{z^2-k^2}=\pi\cot(\pi z)\tag{8} $$ Therefore, $$ \begin{align} \sum_{k=1}^\infty\frac{1}{k^2-z^2} &=\frac{1}{2z^2}-\frac{\pi\cot(\pi z)}{2z}\\ &=\frac{1}{2z}\left[\frac1z-\pi\cot(\pi z)\right]\tag{9} \end{align} $$


You may prove this by expanding $\cos(zx)$ in Fourier series as shown here.

This paper could help too as well as articles in SE dealing with evaluation of $\zeta(n)$ with $n$ even.