Đặt $x=-t \Rightarrow dx=-dt$
$I=-\int \dfrac{\cos (-t)}{2^{-t}+1}dt =\int \dfrac{2^t \cos t}{1+2^t}dt=\int \dfrac{2^x \cos x }{2^x +1}dx$
$\Rightarrow 2I = \int \dfrac{ \cos x }{2^x +1}dx+\int \dfrac{2^x \cos x }{2^x +1}dx =\int \cos x dx=\sin x \bigg |_{-\frac{\pi}{2}}^{\frac{\pi}{2}}=2$