Đặt $x=\pi -t \Rightarrow dx=-dt$
$I=-\int_{\pi}^0 \dfrac{\pi -t}{1+\sin (\pi-t)}dt=\pi\int_0^{\pi} \dfrac{1}{1+\sin t}dt-\int_0^{\pi}\dfrac{t}{1+\sin t}dt$
$=\pi\int_0^{\pi} \dfrac{1}{1+\sin x}dx-\int_0^{\pi}\dfrac{x}{1+\sin xt}dx =\pi\int_0^{\pi} \dfrac{1}{1+\sin t}dt-I$
$\Rightarrow 2I=\pi\int_0^{\pi} \dfrac{1}{1+\sin t}dt =\pi \int \dfrac{1}{(\sin \dfrac{x}{2}+\cos \dfrac{x}{2})^2}dx$
$=\dfrac{\pi}{2} \int \dfrac{1}{\sin^2 (\dfrac{x}{2}+\dfrac{\pi}{4})}dx=\pi\int \dfrac{1}{\sin^2 (\dfrac{x}{2}+\dfrac{\pi}{4})}d(\dfrac{x}{2}+\dfrac{\pi}{4}) =-\pi \cot (\dfrac{x}{2}+\dfrac{\pi}{4}) +C$
Tự thay cận nhé