If you choose to evaluate this using a contour it will not just be similar, but identical to the contour for $\cot(\pi z)$ with a variable change.
It is literally identical, with only a variable change, and you can also choose to do this variable change before or after the integration itself. What you are asking for in the question is doing the variable change before the contour integration, what follows below is doing the variable change after:
By contour integration we have that $$\pi z\cot(\pi z)=1+2z^2\sum_{n=1}^\infty \frac{1}{z^2-n^2}.$$ Let $z=\frac{i}{2}$, then this is $$ \frac{\pi i}{2}\cot\left(\frac{\pi i}{2}\right)=1+2\sum_{n=1}^\infty \frac{1}{4n^2+1}.$$ Since $\coth(z)=i\cot(iz)$ we conclude that $$\sum_{n=0}^\infty \frac{1}{4n^2+1}=\frac{1}{2}+\frac{\pi}{4}\coth\left(\frac{\pi}{2}\right).$$ as desired.
If you want to do the variable change before the contour integration, just look at $z\rightarrow \frac{iz}{2}$. Then we are integrating the function $\pi z \coth \left( \frac{\pi z}{2}\right)$, which really the same function as $\pi z\cot\left(\pi z\right)$.
In a strict sense, the residue theorem only applies to bounded closed contours. The hypotheses of the residue theorem cannot be fulfilled if the contour contains infinitely many singularities, since the union of the contour and its interior is compact, so the singularities must have an accumulation point, which would be a non-isolated singularity for which no residue can be defined.
In a looser sense, the residue theorem is sometimes applied to unbounded "contours", e.g. the real axis closed by a semi-circle "at infinity". To justify this rigorously, one defines a sequence of closed contours such that one part of the contour "goes to infinity" and its contribution to the integral can be shown to go to $0$, while the remainder of the contour either remains finite or grows such that the limit of its contribution is an improper integral, e.g. over the entire real axis.
Thus we are never actually dealing with infinite contours. If we have a sequence of contours that "goes to infinity" and the number of singularities it encloses also goes to infinity in the process, we can apply the finite version of the residue theorem to each contour in the sequence, and then the convergence of the integral to $\sum_n r_n$ enters into the convergence argument that has to be made anyway, and no special argument for applying the residue theorem to infinitely many singularities is required.
To summarize, you can apply the residue theorem to an "infinite contour" enclosing infinitely many singularities, as long as any of the actual contours in the sequence justifying this argument enclose only finitely many singularities; otherwise you have a non-isolated singularity to which the residue theorem doesn't apply.
Alternatively, you can think of contours that extend to infinity as closed contours on the Riemann sphere. Since the Riemann sphere is compact, infinitely many singularities necessarily have an accumulation point on it (which may be the point at infinity), so in this case there can only be finitely many singularities for the function to be meromorphic on and inside the contour.
Best Answer
Going from Phillipe's hint, the basic result for sums of this type (rational function of $n$) is
$$\sum_{n=-\infty}^{\infty} f(n) = -\sum_{k=1}^N \operatorname*{Res}_{z=z_k} \pi \, \cot{(\pi z)} \, f(z)$$
In your case, $f(z)=1/[(z-a)(z-b)]$. This is fairly simple because the poles of $f$ are non-integral and simple. We then have
$$\sum_{n=-\infty}^{\infty} \frac{1}{(n-a)(n-b)} = -\pi \left [\frac{\cot{(\pi a)}}{a-b} + \frac{\cot{(\pi b)}}{b-a} \right ] =-\pi \frac{\cot{(\pi b)}-\cot{(\pi a)}}{b-a} $$
Note that when $a=b$, the sum approaches $\pi^2 \csc^2{(\pi a)}$.