Note that in the last substitution we could have solved the substitution equality for t:

If it looks familiar to you, it is not an accident. We could have changed the integral as follows:

This integral belongs to the box "root from the ratio of linear functions" and we solve such integrals using exactly the substitution we just obtained. This algebraic trick can be used whenever we have a root of a quadratic expression that can be factored.