I need to find for which natural values of $a$ the function $f(x)=x^ae^x$ has exactly one extremum. I calculated the derivative: $f'(x)=e^xx^{a-1}(a+x)$, but I don't know what to do. I know that I can't say that $f$ has only one extremum when the derivative has only one root, because it's not true.
How can I solve this?
I don't know why you say "it's not true". By the usual definition, a stationary point of $f$ is a zero of $f′$, so you are indeed looking for when $f'$ has one zero.
If $a>1$, both $x=0$ and $x=−a$ are stationary points. What happens if $a=0$? If $a=1$?