-Let $a\neq 0$ then how to show $$\int_{-\pi}^{\pi} \frac{\cos^2(x)}{1+a^x} dx= \frac{\pi}{2}$$
I have tried $a=1$ to get that answer is $\int_{0}^{\pi} \cos^2(x) dx$ and it seems correct. now I can't go on with general answer. I think it may use Feynmans Trick.
I used Kellener's good comments, $x\to -x$ $$I =\int_{-\pi}^{\pi} \frac{\cos^2(x)}{1+a^x} dx =\int_{-\pi}^{\pi} \frac{a^x\cos^2(x)}{1+a^x} dx $$
therefore on addition, $$2I = \int_{-\pi}^{\pi}\cos^2(x)dx = \int_{0}^{\pi} 1+\cos(2x) dx = \pi$$
Again get answer again as $\frac{\pi}{2}$. Thanks a lot to Kellener.