Residues at singularities I have the following question:  Show that the integral
$$\int_{-\infty}^{+\infty}\frac{\cos\pi x}{2x-1}dx = -\frac\pi2$$
Clearly there is a singularity at $z=1/2$ but I think this is a removable singularity so it has $0$ residue. Is this right or have I missed another singularity? If I am right, could someone help me to proceed with this question please because I'm not sure how to.
Thanks

The other 4 answers to this problem are very good and have slightly different approaches, but they all rely on residue calculus. It is possible to do this without residue calculus by being clever and differentiating with respect to a parameter.
Note that $\dfrac{\cos \pi x}{2x - 1}$ is even around the point $x = \frac12$, i.e. that $\displaystyle \int_{-\infty}^\infty \dfrac{\cos \pi x}{2x - 1} dx = 2 \int_{-\infty}^{1/2} \dfrac{\cos \pi x}{2x - 1} dx$. So we will only look at this last integral. First, we center this integral in a reasonable way, very similar to SnowAngel6147.
Substituting $x \mapsto \frac12 - x$, and then later $x \mapsto x/\pi$, yields 
$$ - 2\int_\infty^{0}\frac{\cos(\frac{\pi}2 - \pi x)}{-2x}dx = \int_0^\infty \sin\pi x \frac{dx}{x} = \int_0^\infty \frac{\sin x}{x} dx.$$
(Aside: You may wonder why I like to write $dx/x$. It is because that measure is both inversion and scaling invariant, and is sort of the trivial example of a Haar Measure).
To evaluate this integral, we introduce the related 
$$I(a) = \int_0^\infty \frac{\sin x}{x} e^{-ax} dx,$$
so that we would like to evaluate $I(0)$. Differentiate with respect to $a$ (which is justified because we have exponential decay and the dominated convergence theorem) to get
$$I'(a) = -\int_0^\infty \sin x e^{-ax} dx = \left.-\frac{e^{-ax}(\cos x + a\sin x)}{1 + a^2}\right|_0^\infty = -\frac{1}{1+a^2}.$$
Integrating, we see that $I(a) = -\arctan(a) + C$ for some $C$. What is $C$? Notice that $\displaystyle \lim_{a \to \infty} I(a) = 0$ (dominated convergence again), so that $\displaystyle \lim_{a \to \infty} -\arctan(a) + C = 0$. This means that $C = \frac{\pi}{2}$.
And finally, we want $I(0)$, which is just $C$. Thus $I(0) = \dfrac{\pi}{2}$, and we have the answer.
