I can 'explain' how the substitution works $\displaystyle x = \frac{1-t}{1+t}$ but actually it is not the explanation , i am going to change the integral to a form which is more intuitive .

Before this , let me ask you about another integral :

$\displaystyle I = \int_0^{\pi/2} \frac{\sin(x)}{\sin(x) + \cos(x)} ~dx $

Intuition or experiences or your friend tell you to subsitute $\displaystyle x = \frac{\pi}{2} - y $ so we have

$\displaystyle I = \int_0^{\pi/2} \frac{\cos(y)}{\cos(y)+ \sin(y)} ~dy $

$\displaystyle = \int_0^{\pi/2} \frac{\cos(y) + \sin(y) }{\cos(y)+ \sin(y)} ~dy - \int_0^{\pi/2} \frac{\sin(y)}{\cos(y)+ \sin(y)} ~dy $

$\displaystyle = \frac{\pi}{2} - I $ so $\displaystyle I = \frac{\pi}{4} $

Here is another one :

$\displaystyle I = \int_0^{\pi} \frac{x\sin(x)}{1+ \cos^2(x) } ~dx $

Again , they tell us to subsitute $\displaystyle x = \pi - y $

$\displaystyle I = \int_0^{\pi} \frac{(\pi - y)\sin(y) }{1 + \cos^2(y) }~dy $

$\displaystyle = \pi \int_0^{\pi} \frac{\sin(y)}{1 + \cos^2(y) }~dy - I $

$\displaystyle = \pi \left[ - \tan^{-1}[\cos(y)] \right]_0^{\pi} - I $

$\displaystyle = \frac{\pi^2}{2} - I $ so

$\displaystyle I = \frac{\pi^2}{4} $

The tricks of the above two integrals are very similar , what we do is to 'reflect' the integrand to obtain the answers . But we can't explain why one could think of , our intuition always cannot be explained .

This one is very similar .

Sub. $\displaystyle x = \tan(y) $

$\displaystyle dx = \sec^2(y) ~dy $ we have

$\displaystyle I = \int_0^{\pi/4} \ln[1 + \tan(y) ] ~dy $

Again , sub $\displaystyle y = \frac{\pi}{4} - z $ You may find that it is equivalent to sub $\displaystyle x = \frac{1-t}{1+t} $ at the begining as $\displaystyle \tan( \frac{\pi}{4} - \theta ) = \frac{1 - \tan(\theta) }{1 + \tan(\theta) } $

Therefore , $\displaystyle I = \int_0^{\pi/4} \ln{ \left( 1 + \frac{1 - \tan(z) }{1 + \tan(z) \right) }~dz $

$\displaystyle = \int_0^{\pi/4} \ln(2) ~dz - I $

$\displaystyle = \frac{\pi \ln(2)}{4} - I $ so

$\displaystyle I = \frac{\pi \ln(2)}{8} $

You see , these three integrals are not different at all so if you are asking how this works , let me ask you how this also works when applied in the first two integrals .