I dont recall where, but I found this interesting identity a few years ago. It was shown in one of Victor Moll's papers about elliptic integrals.
Corollary 3.1. Let $f$ be an even function with period $a$. Then, $$\int_0^\infty \frac{f(x)}{x} \sin \bigl(\frac{\pi x}{a}\bigr) \,\mathrm{d}x = \frac{\pi}{2} \int_0^{a/2} f(x) \,\mathrm{d}x.$$
To prove this result the following lemma is applied
Lemma 3.1. Let $f$ be an odd periodic function of period $a$. Then $$ \int_0^{\infty} \frac{f(x)}{x} \,\mathrm{d}x = \frac{\pi}{2} \int_0^{a/2} f(x) \cot\bigl( \frac{\pi x}{a} \bigr) \,\mathrm{d}x $$
I have no qualms about this lemma. Further, Victor writes that Corollary 3.1 follows from using the lemma on $f(x) = g(x) \sin (\frac{\pi x}{a})$ with the half-angle formula
$$ \tan \frac{x}{2} = \frac{\sin x}{1 + \cos x} $$
However, this is where my problems starts. Inserting in our values and using that $\cot x = 1/\tan x$
$$ \cot \bigl( \frac{\pi x}{a} \bigr) = \frac{1 + \cos(2\pi x/a)}{\sin(2\pi x/a)}$$
Inserting this into the lemma with $f = g \cdot \sin(\pi x/a)$ gives
$$ \int_0^{\infty} \frac{g(x)}{x} \sin \bigl( \frac{\pi x}{a} \bigr)\,\mathrm{d}x = \frac{\pi}{2} \int_0^{a/2} g(x) \sin \bigl( \frac{\pi x}{a} \bigr) \bigl[ 1 + \cos \bigl( \frac{2 \pi x}{a} \bigr) \bigr] \csc \bigl( \frac{2\pi x}{a} \bigr) \,\mathrm{d}x $$
I would really like the $\csc(x)$ and $\sin(x)$ to cancel out, however the extra factor of $2$ throws the entire calculation of. Any help proving the desired equality would be much obliged.
EDIT: Maybe the lemma is missing a 1/2 factor in the cotan argument?