There are a couple of ways to look at it. If you want a general strategy, try LIATE.
Logarithms
Inverse trig
Algebraic
Trigonometric
Exponential.
Let u=whichever expression comes first in your integrand; then let dv=the next.
Ex:
<br />
<br />
\int(2x\*\sin(x))dx<br />
<br />
let u=2x (because it is algebraic) and dv=\sin(x)dx (because it is trigonometric)
LIATE won't always work; it's just a nice first try type of strategy. However, I prefer to think of it this way:
I choose the easiest function to integrate to be dv, and everything else to be differentiated because differentiation is easy and integration is harder. I can differentiate anything, but I can't integrate everything. In the above example, since neither expression is really any harder or easier to integrate, I might refer to the LIATE strategy to pick my subs. But it is good to be mindful of your substitutions and think ahead to what will happen.
What would have happened if I'd let u=\sin(x) and dv=2x dx instead? I'd get a recursion that is not helpful: 2x becomes x^2, \sin(x) becomes -\cos(x) and I'm in no better position. Integrating by parts again, x^2 becomes x^3/3, and -\cos(x) becomes -\sin(x), which is again, not helpful.
So try to think ahead, and see if you'll need to integrate by parts multiple times. If so, let u=whatever is going to "ratchet down" to zero-power by repeated differentiation.
Hope this helps, cheers!