Best approach to solve this integral? I'm lost. I tried u-substitution and integration by parts, and ended up with nothing good. 
By parts just repeats itself over and over again. What should I do?
$$\int(e^{-t}+3e^{-t}\sin(t))dt$$
The first integral is easy. It's the 2nd one I don't get. Doing by parts:
$u = e^{-t}$
$du = -e^{-t}$
$dv = \sin(t) dt$
$v = -\cos(t)$
$$uv - \int vdu = -e^{-t}\cos(t) - \int(\cos(t)e^{-t})dt$$
So, is this integral impossible to solve?
 A: Trying to be more general, for the computation of $$I=\int e^{-at}\cos(bt)\,dt$$ let us also consider  $$J=\int e^{-at}\sin(bt)\,dt$$ So, $$I+i J=\int e^{-at}\Big(\cos(bt)+i\sin(bt)\Big)\,dt=\int e^{-at} e^{ibt}\,dt=\int e^{-(a-ib)t} \,dt=\frac{e^{ -(a-i b)t}}{-a+i b}$$ Now, computing the real and imaginary parts of the last expression, we then get $$I=\frac{e^{-a t} (b \sin (b t)-a \cos (b t))}{a^2+b^2}$$ $$J=-\frac{e^{-a t} (a \sin (b t)+b \cos (b t))}{a^2+b^2}$$
A: There are of course several ways of calculating the integrals
$$I=\int e^{-at}\cos(bt)\,dt$$
and
$$J=\int e^{-at}\sin(bt)\,dt.$$
@Claude Leibovici mentions one nice way in his answer and @Chilango and @A.G. two others in comments. I give this answer just for funt and just to show another way, that I think is less known. I think this site is a nice place to show such things. I don't claim it is easier. I actually think that it is conceptually more difficult but once known, the calculations are very simple.

Warning 
Don't use this method if you do not understand how it works and what you are allowed to do, since it will otherwise (just as other methods) don't work. Also, I don't claim my derivation to be totally rigorous. I suggest to get a copy of some ODE book where it is present.

I show the method for $J$ (since this is the one appearing in the question) and leave it to others to do $I$. We want to solve $DJ=e^{-at}\sin(bt)$, where $D$ is the differential operator. This can, formally, be written
$$
J=D^{-1}e^{-at}\sin(bt).
$$
The idea is to commute $D^{-1}$ and $e^{-at}$:
$$
D^{-1}e^{-at}f(t)=e^{-at}(D-a)^{-1}f(t).
$$
Small check: Taking derivatives on both sides:
$$
\begin{aligned}
\text{LHS:} \quad DD^{-1}e^{-at}f(t)&=e^{-at}f(t)\\
\text{RHS:} \quad De^{-at}(D-a)^{-1}f(t)&=-ae^{-at}(D-a)^{-1}f(t)+e^{-at}D(D-a)^{-1}f(t)\\
&=e^{-at}(D-a)(D-a)^{-1}f(t)\\
&=e^{-at}f(t).
\end{aligned}
$$
We find that
$$
J=e^{-at}(D-a)^{-1}\sin(b t).
$$
Inserting $(D+a)(D+a)^{-1}$, and using $(D+a)^{-1}(D-a)^{-1}=(D^2-a^2)^{-1}$, we get
$$
J=e^{-at}(D+a)(D+a)^{-1}(D-a)^{-1}\sin(bt)=e^{-at}(D+a)(D^2-a^2)^{-1}\sin(bt).
$$
Now, $D^2\sin(bt)=-b^2\sin(bt)$, so $(D^2-a^2)^{-1}\sin(bt)=(-b^2-a^2)^{-1}\sin(bt)$, and $(-b^2-a^2)^{-1}$ is just a number and can be moved to the left. Hence
$$
J=e^{-at}(D+a)(-b^2-a^2)^{-1}\sin(bt)=-\frac{1}{a^2+b^2}e^{-at}(D+a)\sin(bt).
$$
Finally, we note that $(D+a)\sin(bt)=b\cos(bt)+a\sin(bt)$, so
$$
J=-\frac{1}{a^2+b^2}e^{-at}\bigl(b\cos(bt)+a\sin(bt)\bigr).
$$
This all became rather long to describe, but here goes the calculation in the particular example:
$$
\begin{aligned}
\int e^{-t}\sin t\,dt &= D^{-1}e^{-t}\sin t=e^{-t}(D-1)^{-1}\sin t\\
&=e^{-t}(D+1)(D^2-1^2)^{-1}\sin t=-\frac{1}{2}e^{-t}(D+1)\sin t\\
&=-\frac{1}{2}e^{-t}\bigl(\cos t+\sin t\bigr).
\end{aligned}
$$

Small challenge to the ones who read all through: 
Try to adapt this method to calculate $\int t^2e^{-t}\,dt$?

A: $  let.    I=\int e^{-t} (\ sin t)   dt$

$Here.   u=\sin t , v=e^{-t}$

$\implies I= \sin t  \int e^{-t} dt -\int [{\frac{d}{dx}(\ sin t ){\int e^{-t}dt}}] dt$
$\implies I={\sin t}[\frac{e^{-t}}{-1}]+\int \cos t e^{-t}dt$
$\implies I={\sin t}[\frac{e^{-t}}{-1}]+\cos t \int e^{-t}dt -\int[\frac{d}{dx}(\ cost )\int e^{-t}dt]dt$
$\implies I=-{e^{-t}}(\sin t )-(\cos t ) e^{-t} -\int[(-\sin t )(- e^{-t})]dt$
$\implies I=-{e^{-t}}(\sin t )-(\cos t ) e^{-t} -I$
$\implies 2I=-{e^{-t}}[\sin t +\cos t ]$
$\implies I=\frac{-{e^{-t}}}{2}[\sin t +\cos t ]$----->(1)
Now 
$\int[ e^{-t}+3 e^{-t}\ sin t ] dt= \int e^{-t}dt+3\int e^{-t}\sin t dt$
From eq(1)
$\int[ e^{-t}+3 e^{-t}\ sin t ] dt= -e^{-t}-\frac{3e^{-t}}{2}[\sin t+\cos t]$
A: (Not an answer but too long for a comment): Note that you can use Maple to suggest solution for you (but it is questionable how simple the suggested solution really is), in this case:
Student[Calculus1][IntTutor](exp(-t)+3*exp(-t)*sin(t),t);

Ouput:

