Inverse Functions and $u$-Substitution Back in my undergrad days I wrote a false proof of the following.
Problem. Prove that $\displaystyle\int_0^{2\pi}\frac{dx}{1+e^{\sin{x}}}=\pi$
Proof. Integrating by parts gives
$$
\int_0^{2\pi}\frac{dx}{1+e^{\sin{x}}}
= \left.\frac{x}{1+e^{\sin{x}}}\right\vert_0^{2\pi}+\int_0^{2\pi}
x\cdot\frac{e^{\sin x}\cos{x}}{(e^{\sin{x}}+1)^2}dx 
=\pi+\int_0^{2\pi}
x\cdot\frac{e^{\sin x}\cos{x}}{(e^{\sin{x}}+1)^2}dx 
$$
Taking $u=\sin x$ in the last integral gives
$$
\int_0^{2\pi}
x\cdot\frac{e^{\sin x}\cos{x}}{(e^{\sin{x}}+1)^2}dx 
=\int_0^0\arcsin u\frac{e^u}{(e^u+1)}du=0
$$
and combining the two equations gives the result. $\Box$
Of course, the problem with this proof is that the equation $x=\arcsin u$ is only valid on $[0,\pi/2]$. However, $\sin{x}$ is invertible on the intervals $[\pi/2,3\pi/2]$ and $[3\pi/2,2\pi]$ so it seems that this problem can be circumvented by splitting the integral up into three integrals and individually applying the $u$-substitution. 
Can this proof be salvaged?
Edit: I'm aware that there are other ways to prove this result. I'm mainly concerned with the validity of this proof.
Edit: I've voted up both answers because they give correct proofs. I haven't accepted an answer, however, because neither addresses the issue of breaking up a noninvertible function into seperate integrals where the function is invertible, which was my main reason for posting this question.
 A: Calculation of original integral $$\int_{0}^{2\pi}\frac{dx}{1 + e^{\sin x}}$$ can be done directly using the hint from lab bhattacharjee. I believe you would want to have a proof that the complicated integral $$I = \int_{0}^{2\pi}x\frac{e^{\sin x}\cos x}{(1 + e^{\sin x})^{2}}\,dx = 0$$
To that end let's apply the hint (again) from lab bhattacharjee to get $$I = \int_{0}^{2\pi}(2\pi - x)\frac{e^{\sin x}\cos x}{(1 + e^{\sin x})^{2}}\,dx$$ so that by adding these two equivalent forms of $I$ we get $$I = \pi\int_{0}^{2\pi}\frac{e^{\sin x}\cos x}{(1 + e^{\sin x})^{2}}\,dx = \pi\left(\int_{0}^{\pi}\frac{e^{\sin x}\cos x}{(1 + e^{\sin x})^{2}}\,dx + \int_{\pi}^{2\pi}\frac{e^{\sin x}\cos x}{(1 + e^{\sin x})^{2}}\,dx\right)$$ or $I = \pi(I_{1} + I_{2})$.
Now we can put $t = x - \pi$ in second integral $I_{2}$ to get $$I_{2} = -\int_{0}^{\pi}\frac{e^{\sin t}\cos t}{(1 + e^{\sin t})^{2}}\,dt = -I_{1}$$ It now follows that $I = \pi(I_{1} + I_{2}) = 0$.
Update: After the edit by OP, it is clear that what is needed here is to apply the substitution $u = \sin x$ and then show that the integral $I$ is $0$. As he has mentioned in his question this would need a split into three integrals over the range $[0, \pi/2], [\pi/2, 3\pi/2]$ and $[3\pi/2, 2\pi]$. After the substitution the intervals will change to $[0, 1], [-1, 1]$ and $[-1, 0]$. On doing this substitution it will be found that the integral is equal to $$I = I_{1} + I_{2} + I_{3} = \int_{0}^{1}\frac{e^{u}\arcsin u}{(e^{u} + 1)^{2}}\,du - \int_{-1}^{1}\frac{e^{u}(\pi + \arcsin u)}{(e^{u} + 1)^{2}}\,du + \int_{-1}^{0}\frac{e^{u}(2\pi + \arcsin u)}{(e^{u} + 1)^{2}}\,du$$
Note that in the interval $[0, \pi/2]$ the function $u = \sin x$ increases and hence the mapping $\sin x = u$ can be inverted by $x = \arcsin u$ and it maps $[0, \pi/2]$ into $[0, 1]$. In the interval $[\pi/2, 3\pi/2]$ the function $u = -\sin x$ increases and the inverse happens using $x = (\pi + \arcsin u)$ and since $-\cos x \, dx = du$ we get a $-$ sign in the integral. Again in the interval $[3\pi/2, 2\pi]$ the function $\sin x$ increases and the correct inverse is $x = 2\pi + \arcsin u$. Since the function $e^{u}/(e^{u} + 1)^{2}$ is even we have $$\begin{aligned}I &= \int_{-1}^{0}\frac{e^{u}\arcsin u}{(e^{u} + 1)^{2}}\,du + \int_{0}^{1}\frac{e^{u}\arcsin u}{(e^{u} + 1)^{2}}\,du - \int_{-1}^{1}\frac{e^{u}\arcsin u}{(e^{u} + 1)^{2}}\,du\\
&\,\,\,+\,\,2\pi\int_{-1}^{0}\frac{e^{u}}{(e^{u} + 1)^{2}}\,du - \pi\int_{-1}^{1}\frac{e^{u}}{(e^{u} + 1)^{2}}\,du = 0\end{aligned}$$
A: Not sure how you have reached at 
$$\left.\frac{x}{1+e^{\sin{x}}}\right\vert_0^{2\pi}=\pi$$
Here is another way:
$$\text{Use }I=\int_a^bf(x)dx=\int_a^bf(a+b-x)dx$$
$$2I=\int_a^bf(x)dx+\int_a^bf(a+b-x)dx=\int_a^b[f(x)+f(a+b-x)]dx$$
utilizing $$\displaystyle\sin(2\pi+0-x)=-\sin x$$
