Dealing with integrals of the form $\int{e^x(f(x)+f'(x))}dx$ Integrals of the form $$\int{e^x(f(x)+f'(x))}dx$$ are very common. And I have seen this form appearing in several exam papers.But the problem I face with this particular type of integral is finding what $f(x)$ could be.Its more of a trial and error method.
My question is:
Is there any sure shot method to find $f(x)$(i.e. break the expression inside the bracket as $f(x)+f'(x)$) given that I know that the integral will be of the form $e^x(f(x)+f'(x))$?
 A: No, there is not a way such that for any given $g(x)$ which should be of he form $g(x) =  f(x)+f'(x)$ to find the function $f(x)$ except trial and error and/or experience.
A: Integrating by parts
$$\int e^x f'(x)dx=e^xf(x)-\int e^xf(x)dx.$$ Rearranging terms and adding a constant we get
$$\int e^x(f(x)+f'(x))dx=e^xf(x)+C.$$
Note that this equality holds for any differentiable function $f.$ 
Edit
If you want to write $g(x)$ as $f(x)+f'(x)$ you need to solve the differential equation $y'+y=g(x).$ Its solution is given by
$$y(x)=ce^{-x}+e^{-x}\int_1^x e^tg(t)dt.$$ That is, you need to know $\int e^xg(x)dx$ to solve it. 
A: You should know that 
$$
(\mathrm{e}^x)' = \mathrm{e}^x
$$
So you can see that
$$
\dfrac{d}{dx}\mathrm{e}^xf(x) = (\mathrm{e}^x)'f(x) + \mathrm{e}^xf'(x)
$$
And then use the expression in my first line.
Beyond this I am not sure what the problem is?
A: I asked myself the same question as that by OP. I arrived at the fact that to find $f(x)$ one should solve the differential equation given above by mfl above. But the solution of the differential equation requires to compute first the integral of $g(x)e^x$, so a circular problem. 
What OP is asking is how to solve the differential equation without doing integral calculus and when the solution $f(x)$ is found then we claim that the integral of $g(x)e^x$ is nothing but $f(x)e^x+C$. 
To arrive at a satisfactory answer, do not ask yourself how to find a way to find $f(x)$ for ANY given $g(x)$. But ask how to find $f(x)$ for some classes of $g(x)$, as polynomials as so on. Classes we do find in textbooks exercises. 
Actually, I did find a way for the following classes of $g(x)$ we find in textbooks.


*

*Polynomials (of any degree), 

*sin x, cos x and any linear combinaison of sin x and cos x, next,

*$x \sin x$ and $x \cos x$ and any linear combinaison of them, next 

*$x^{2}\sin x$ and $x^2\cos x$ and any linear combinaison of them, next 

*Some partial fractions when the degree of the denominator is 2.
I also have tested the way to find $f(x)$ for each class cited above for most concrete examples in some textbooks (old and new). I do not believe that it is always better than usual integration by parts.
The same technique works for case $f'(x)+g'(x)f(x)$. Recall that $$\int (f'(x)+g'(x)f(x))e^{g(x)} dx = f(x)e^{g(x)}+C.$$  
What i did discover of great value (at least for me) is that the $g(x)$ of ANY concrete textbook exercise is of the form $f(x)+f'(x)$ (or the form $f'(x)+g'(x)f(x)$) and the  $f(x)$ can be found almost easily even for the following monster-looking example 
Computing an awful integral 
i did find the solution easily without trial-error method but by following a straight path!
When time permitted i will give some examples of finding $f(x)$ for $g(x)$ belonging to some of the cited classes.
EDIT: Here is a first example dealing with polynomial case
Evaluate the integral $\int \left( 2x^{5}+x^{3}+x\right) e^{x^{4}+x^{2}}dx$ It is of the form 
\begin{equation*}
\int \left( 2x^{5}+x^{3}+x\right) e^{x^{4}+x^{2}}dx=\int h(x)e^{g(x)}dx.
\end{equation*} 
This form recalls the well-known formula 
\begin{equation*}
\int \left( f^{\prime }(x)+g^{\prime }(x)f(x)\right)
e^{g(x)}dx=f(x)e^{g(x)}+C.
\end{equation*} 
So we are done if we find a function $f(x)$ such that 
\begin{equation*}
h(x)=f^{\prime }(x)+g^{\prime }(x)f(x).
\end{equation*} 
In what follows, I will show that $f(x)=\frac{1}{2}x^{2},$ and therefore 
\begin{equation*}
\int \left( 2x^{5}+x^{3}+x\right) e^{x^{4}+x^{2}}dx=\left( \frac{1}{2} 
x^{2}\right) e^{x^{4}+x^{2}}+C.
\end{equation*} 
$\color{red}{\bf Problem:}$ We want to write $\left( 2x^{5}+x^{3}+x\right) $ as $ 
f^{\prime }(x)+g^{\prime }(x)f(x)$ where $g(x)=x^{4}+x^{2},$ $g^{\prime
}(x)=4x^{3}+2x$ and $f(x)$ is to be determined. 
First, it is easy to see that 
\begin{equation*}
\left( 2x^{5}+x^{3}+x\right) =x+(2x^{3}+x)(x^{2})=x+(4x^{3}+2x)(\frac{x^{2}}{ 
2})=x+g^{\prime }(x)(\frac{x^{2}}{2}).
\end{equation*} 
If we put $f(x)=(\frac{x^{2}}{2}),$ then 
\begin{equation*}
f^{\prime }(x)+g^{\prime }(x)f(x)=\left( x\right) +(4x^{3}+2x)\left( \frac{ 
x^{2}}{2}\right) =x+2x^{5}+x^{3}=\left( 2x^{5}+x^{3}+x\right) ,
\end{equation*} 
we are done! Then, it suffices to take 
\begin{equation*}
f(x)=(\frac{x^{2}}{2}).\ \ \ 
\color{red} 
 \blacksquare 
\end{equation*}
EDIT: the following is of interest
$f(x) - f'(x) = x^3 + 3x^2 + 3x +1; f(9) =?$
EDIT: this one is of interest too
Proof for formula $\int e^{g(x)}[f'(x) + g'(x)f(x)] dx = f(x) e^{g(x)}+C$
EDIT: I have provided an example here
Computing $\int (1 - \frac{3}{x^4})\exp(-\frac{x^{2}}{2}) dx$
EDIt another example here
Evaluating integral $\int\frac{e^{\cos x}(x\sin^3x+\cos x)}{\sin^2x}dx $
and The monster integral here
Compute $\int_0^{\pi/4}\dfrac{(1-x^2)\ln(1+x^2)+(1+x^2)-(1-x^2)\ln(1-x^2)}{(1-x^4)(1+x^2)} x\exp\dfrac{x^2-1}{x^2+1} dx$
