<s>[INST] By using the properties of definite integrals, evaluate $\int_0^{\pi}\frac{x}{1+\sin x}dx$ 
By using the properties of definite integrals, evaluate $\int_0^{\pi}\frac{x}{1+\sin x}dx$.

My attempt:
(Using the property $\int_0^{2a}f(x)dx=\int_0^a(f(x)+f(2a-x))dx$)
$$\int_0^{2\frac{\pi}{2}}\frac{x}{1+\sin x}dx=\int_0^{\frac{\pi}{2}}(\frac{x}{1+\sin x}+\frac{\pi-x}{1+\sin x})dx$$$$=\pi\int_0^{\frac{\pi}{2}}\frac1{1+\sin x}dx=\pi\int_0^{\frac{\pi}{2}}\frac{1-\sin x}{\cos^2x}dx$$$$=\pi\int_0^{\frac{\pi}{2}}(\sec^2x-\sec x\tan x)dx=\pi[\tan x-\sec x]_0^{\frac{\pi}{2}}$$
Now I am stuck. I understand there might be other ways of solving it, but what's wrong in my method? Why am I not getting the answer?
 [/INST] Alternatively, I like to try to change sine to cosine and then tackle it by the properties of odd and even functions.
First of all,  I use the substitution $y=\dfrac{\pi}{2}-x,$ then
$$
\begin{aligned}
I &=\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{\frac{\pi}{2}-y}{1+\cos y} d y \\
&=\frac{\pi}{2} \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{d y}{1+\cos y}-\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{y}{1+\cos y} d y \\
&=\frac{\pi}{2} \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{d y}{1+\cos y} \quad \text { (By the fact that } \frac{y}{1+\cos y} \textrm{ is odd.}) \\
&=\frac{\pi}{2} \int_{0}^{\frac{\pi}{2}} \sec ^{2} \frac{y}{2} d y \\
&=\pi\left[\tan \frac{y}{2}\right]_{0}^{\frac{\pi}{2}} \\
&=\pi
\end{aligned}
$$
:|D Wish you enjoy the proof!
</s>