To Find $\int_0^{\pi} \frac{\sin(x)}{1+\sin(x)}$ why the substitution of $\sin(x)=t$ Gives wrong answer?
The sine function is not an injective function over the interval $(0,\pi)$. If you want to apply the substitution $\sin(x)\mapsto z$, you have to break the integration range in halves: this because a valid substitution is given by a diffeomorphism, not just a differentiable map.
In simple words, you are allowed to state that $$\int_{a}^{b}f(x)\,dx = \int_{g^{-1}(a)}^{g^{-1}(b)} f(g(s))\,g'(s)\,ds$$ only if $g$ is an injective function over the involved integration range, and $\sin(x)$ is not injective over $(0,\pi)$. Otherwise you would get $\int_{0}^{\pi}\sin(x)\,dx=0$ and that is clearly wrong.
A possible way to go is: since the $\sin(x)$ function is symmetric with respect to the point $x=\pi/2$, $$ \int_{0}^{\pi}\frac{\sin(x)\,dx}{1+\sin(x)}=2\int_{0}^{\pi/2}\frac{\sin(x)\,dx}{1+\sin(x)}=2\int_{0}^{1}\frac{t\,dt}{(1+t)\sqrt{1-t^2}}.$$
That is correct, even if not the most efficient way for computing such integral.
A more efficient way is to set $x=2\arctan\frac{t}{2}$ (aka Weierstrass substitution) to get
$$16\int_{0}^{+\infty}\frac{t\,dt}{(4+t^2)(2+t)^2}$$
that can be tackled through partial fraction decomposition.
Method 2 fails since on $[0,\pi]$, $\sin(x)$ is not monotone, so we don't have a good inverse to apply. We need to break the interval into intervals on which $\sin(x)$ is monotone. For example, $\left[0,\frac\pi2\right]$ and $\left[\frac\pi2,\pi\right]$. In fact, using the substitution $x\mapsto\pi-x$, we get $$ \int_0^{\pi/2}\frac{\sin(x)}{1+\sin(x)}\,\mathrm{d}x=\int_{\pi/2}^\pi\frac{\sin(x)}{1+\sin(x)}\,\mathrm{d}x $$ so that $$ \begin{align} \int_0^\pi\frac{\sin(x)}{1+\sin(x)}\,\mathrm{d}x &=2\int_0^{\pi/2}\frac{\sin(x)}{1+\sin(x)}\,\mathrm{d}x\\ &=2\int_0^1\frac{t}{1+t}\,\mathrm{d}\arcsin(t)\\ &=2\int_0^1\frac{t}{1+t}\frac{\mathrm{d}t}{\sqrt{1-t^2}}\\ &=2\int_0^1\left(1-\frac1{1+t}\right)\frac{\mathrm{d}t}{\sqrt{1-t^2}}\\ &=\pi-2\int_0^1\frac1{1+t}\frac{\mathrm{d}t}{\sqrt{1-t^2}}\\ &=\pi-2\left[-\sqrt{\frac{1-t}{1+t}}\,\right]_0^1\\[6pt] &=\pi-2 \end{align} $$