Compute $I=\int e^{it}\cos t\,dt$ Compute $I:=\int e^{it}\cos t\,dt$, where $i\in\mathbb{C}$.
Attempt: Let $u=e^{it}$, $dv=\cos t\,dt$. Then $du=ie^{it}\,dt$ and $v=\sin t$
Using  integration by parts, we have $I=u=e^{it}\sin t-i\int e^{it}\sin t\,dt$. Say $I_1:=\int e^{it}\sin t\,dt$. By the same method, we have $I_1=-e^{it}\cos t+i\cdot I$. So we get $ I=e^{it}\sin t-i(-e^{it}\cos t+i\cdot I)=e^{it}\sin t+ie^{it}\cos t+I$. 
Can anyone find my mistake?

Your work is correct and means that, for a imaginary exponent, the classical double integration by part (*), that I suppose you well know for real exponent, does not work. Simply you have found that your primitive function $I$ is defined up to constant $i= e^{it \sin t}+i e^{it}\cos t$.

(*)
For  a real exponent $a$ we have:
$$
\int e^{at}\cos t dt=e^{at}\sin t-a\int e^{at}\sin t dt 
$$
and
$$
\int e^{at}\sin t dt=-e^{at}\cos t+a\int e^{at}\cos t dt
$$
so that:
$$
\int e^{at}\cos t dt=e^{at}\sin t+a e^{at}\cos t -a^2\int e^{at}\cos t dt
$$
and we find:
$$
\int e^{at}\cos t dt=\dfrac{e^{at}(\sin t+a \cos t)}{(1+a^2)}
$$
up to a constant.
Note that, if $a$ is not a real number, for this derivation we need $a^2\ne -1$.
