Integration by parts

The integral of u dv = uv - ( integral of vdu)

You have to be able to integrate 'dv' that you choose. If you can integrate both possible choices, then you want the 'u' to be the choice that would eventually differentiate to zero.

See the notes from last year about integrations by parts. There are more examples there.