Calculate infinite sum with residues I'm trying to use the residue theorem to calculate 
$$\sum_{k=1}^{\infty} \dfrac{1}{(2k-1)^2}.
$$
I came up with $\operatorname{Res}\left(\dfrac{\pi \cot(\pi z)}{(2z-1)^2},\frac12\right)=-\pi^2$ and $\operatorname{Res}\left(\dfrac{\pi \cot(\pi z)}{(2z-1)^2},0\right)=1$.  This leaves me with $\pi^2-1=2\sum_{k=0}^{\infty}=2(\sum_{k=1}^{\infty}+1)$.  Doing the algebra gives $\sum_{k=1}^{\infty}=\dfrac{\pi^2-2}{2}$, while the answer is $\dfrac{\pi^2}{8}$.  I would appreciate it if anyone could help me identify where I am going wrong.
 A: METHOD 1:
Following the way forward in the original post, we note that 
$$\text{Res}\left(\frac{\pi \cot(\pi z)}{(2z-1)^2},z=n\right)=\lim_{z\to n}\left((z-n)\frac{\pi \cot(\pi z)}{(2z-1)^2}\right)=\frac{1}{(2n-1)^2}$$
$$\text{Res}\left(\frac{\pi \cot(\pi z)}{(2z-1)^2},z=1/2\right)=\lim_{z\to 1/2}\left((z-1/2)\frac{\pi \cot(\pi z)}{(2z-1)^2}\right)=\frac{1}{(2n-1)^2}=-\frac{\pi^2}{4}$$
Then, since (as discussed in Method $2$) the sum of the residues add to zero, we have
$$\bbox[5px,border:2px solid #C0A000]{\sum_{n=1}^\infty\frac{1}{(2n-1)^2}=\frac{\pi^2}{8}}$$
where we used $\sum_{n=-\infty}^\infty \frac{1}{(2n-1)^2}=2\sum_{n=1}^\infty \frac{1}{(2n-1)^2}$.

METHOD 2:
Let $f(z)=\frac{\pi \tan(\pi z)}{z^2}$.  Note that $f$ has simple poles a $z=0$ and $z=\frac{2n-1}{2}$ for all integer values of $n$.  Also note that since $f$ is an odd function of $z$ and $O(z^{-2})$ for large $|z|$, we have
$$\oint_C f(z)\,dz=0$$
where $C$ is the closed contour in the upper-half plane comprised of the real axis, with infinitesimal semi-circular deformations around the poles, and the "infinite" semi-circle.  Therefore, we have
$$\text{Res}\left(\frac{\pi \tan(\pi z)}{z^2},z=0\right)+\sum_{n=-\infty}^\infty \text{Res}\left(\frac{\pi \tan(\pi z)}{z^2},\frac{2n-1}{2}\right)=0 \tag 1$$
To calculate the residues at a simple poles, we evaluate the limits 
$$\lim_{z\to 0}\left(z\,\frac{\pi \tan(\pi z)}{z^2}\right)=\pi^2 \tag 2$$
and
$$\lim_{z\to \frac{2n-1}{2}}\left(\left(z-\frac{2n-1}{2}\right)\,\frac{\pi \tan(\pi z)}{z^2}\right)=-\frac{1}{\left(\frac{2n-1}{2}\right)^2} \tag 3$$
Using $(2)$ and $(3)$ in $(1)$ we obtain
$$\pi^2=\sum_{n=-\infty}^\infty\frac{4}{(2n-1)^2}=8\sum_{n=1}^\infty\frac{1}{(2n-1)^2}\tag 4$$
whereupon dividing both sides of $(4)$ by $8$ yields the coveted result
$$\bbox[5px,border:2px solid #C0A000]{\sum_{n=1}^\infty\frac{1}{(2n-1)^2}=\frac{\pi^2}{8}}$$
