Practically speaking, you didn't, so simply remember from now on that if you have an integral of the form
you can make the substitution .
Sometimes in order to do an integral you have to have seen how it is done first. Some people have an easier time seeing how to do these than others. There is no method I know of telling you how to approach an integral, it's a matter of experience. There is no shame in this.