The product rule, (uv)′=uv′+vu′, integrates to uv=∫udv+∫vdu, and rearranged that is integration by parts: ∫udv=uv−∫vdu, read aloud: the integral of u dee v equals u v minus the integral of v dee u. The letters: u is one factor of the integrand and dv is the other factor with the dx attached; du=u′dx is the derivative of u, and v is any antiderivative of dv, with no +C needed until the very end. The trade: the integral you cannot do, ∫udv, becomes a product you can write down, uv, minus an integral you hope is easier, ∫vdu. For ∫xexdx: u=x, dv=exdx; then du=dx, v=ex; and ∫xexdx=xex−∫exdx=xex−ex+C. Differentiate it: ex+xex−ex=xex, the integrand back, which is the only check that matters.
Trig runs the same: ∫xcosxdx with u=x, dv=cosxdx, v=sinx, gives xsinx−∫sinxdx=xsinx+cosx+C, the minus of the formula meeting the minus of ∫sinx=−cosx. The lonely logarithm is the classic: ∫lnxdx has only one visible factor, so take u=lnx and dv=dx; then du=xdx, v=x, and ∫lnxdx=xlnx−∫x⋅x1dx=xlnx−x+C. Two slips to name: the uv term dropped, leaving only −∫vdu; and the sign flipped, uv+∫vdu. With limits, the product is evaluated too: ∫abudv=[uv]ab−∫abvdu, so ∫01xexdx=[xex−ex]01=(e−e)−(0−1)=1.