There are a few circumstances where there are clear "forms" which are appropriate for integrating by parts.
The first of these is when you have some the form #int x^n f(x) dx#, where #f(x)# is some function that you can repeatedly integrate. For example, #int (x^3sin(x))dx# is a prime candidate for integration by parts. You will be repeatedly taking the derivative of #x^3# and repeatedly integrating #sin(x)#. After a few application of integration by parts, the #x^3# will turn into a #0#, giving you a solvable integral.
Another case where integration by parts finds use is when you have the form #int f(x)g(x) dx#, where after repeated integration by parts, you end up with an integral which resembles your original integral. For example, #int (e^xsinx)dx# is such a function. The integral of #e^x# is #e^x# and after taking the derivative of #sinx# twice, you end up with another instance of #sinx#.
We'll solve an example of each.
#int (x^2sinx)dx#
After applying integration by parts once, we get:
#-x^2cosx + int (2xcosx)dx#
Apply again to get:
#-x^2cosx + 2xsinx -2int(sinx)dx#
The integral is now solvable, yielding the answer:
#-x^2cosx + 2xsinx + 2cosx + C#
Now consider #int (e^x sinx)dx#.
After applying integration by parts twice, we get:
#int(e^xsinx)dx = e^xsinx - e^xcosx - int(e^xsinx)dx#
Let #I = int(e^xsinx)dx# and we have
#I = e^xsinx - e^xcosx - I#
#2I = e^xsinx - e^xcosx#
#I = (1/2)(e^x)(sinx - cosx)#
Since #I# is our original integral, we've found our answer.