<s>[INST] Prove: $\int_{0}^{\pi}\frac{x\tan x}{\sec x+\cos x}dx = \frac{\pi^{2}}{4}$ How to prove following?
$$\int_{0}^{\pi}\frac{x\tan x}{\sec x+\cos x}dx  = \frac{\pi^{2}}{4}$$
 [/INST] $$\dfrac{x \tan(x)}{\sec(x) + \cos(x)} = \dfrac{x\sin(x)}{\cos(x) \cdot \sec(x) + \cos^2(x)} = \dfrac{x \sin(x)}{1+\cos^2(x)} = \sum_{k=0}^{\infty} (-1)^kx \sin(x) \cos^{2k}(x)$$
Hence,
$$I = \int_0^{\pi} \dfrac{x \tan(x)}{\sec(x) + \cos(x)} dx = \sum_{k=0}^{\infty}(-1)^k \int_0^{\pi} x \sin(x) \cos^{2k}(x) dx$$
Let $I_k = \displaystyle \int_0^{\pi} x \sin(x) \cos^{2k}(x) dx$. Replacing $x$ by $\pi-x$, we get $$I_k = \int_{0}^{\pi} (\pi-x) \sin(x) \cos^{2k}(x)dx = \pi \int_0^{\pi} \sin(x) \cos^{2k}(x)dx - I_k$$
Hence,
$$2I_k = \pi \int_0^{\pi} \sin(x) \cos^{2k}(x)dx = \pi \cdot \dfrac2{2k+1} \implies I_k = \dfrac{\pi}{2k+1}$$
Hence,
$$I = \sum_{k=0}^{\infty}(-1)^k I_k = \pi \left(\sum_{k=0}^{\infty} \dfrac{(-1)^k}{2k+1}\right) = \pi \cdot \dfrac{\pi}4 = \dfrac{\pi^2}4$$
</s>