$\displaystyle \int \frac {dx}{\sqrt {x^2+a^2}}$

In my solution book it says

Let $\displaystyle t=x+\sqrt {x^2+a^2}$

How do you figure what to use as substitution

I'm too lazy to type this out, so here's a picture.

In the circled part, how do they get from that trig expression to that?