Let be $a>0$ and $X$ uniformly distributed on $[-a,a]$ compute the second moment, i.e. $\mathbb{E}(X^2)$, by differentiating $\mathbb{E}(e^{itX})$, $t\in\mathbb{R}$, two times with respect to $t$.
My approach:
We see that $\mathbb{E}(X^2)=\frac{a^2}{3}$ and $\mathbb{E}(e^{itx})=\frac{e^{iat}-e^{-iat}}{2ait}=\frac{\sin(at)}{at}$ if $t\neq 0$ and if $t=0$ then simply $\mathbb{E}(e^{i\cdot 0\cdot x})=1$
Ok, then we compute the first and second derivative, if $t\neq 0$: $$\begin{align*} &\frac{d}{dt}\left(\frac{\sin(at)}{at}\right)=\frac{t\cos(at)-\sin(at)}{at^2},\\ &\frac{d}{dt}\left(\frac{t\cos(at)-\sin(at)}{at^2}\right)\\ &=\frac{(\cos(at)-at\sin(at)-a\cos(at))\cdot at^2-2at(t\cos(at)-\sin(at))}{a^2t^4}\\ &=\frac{(1-a)\cos(at)+a^2t^3\sin(at)-2at^2\cos(at)+2at\sin(at))}{a^2t^4}. \end{align*}$$
To compute the first derivative at $t=0$ we look at the limit
$$ \begin{align*} &\lim\limits_{t\to0}\frac{\frac{\sin(at)}{at}-1}{t}=\lim\limits_{t\to0}\frac{\sin(at)-at}{at^2}=\dots=0. \end{align*} $$ because we can apply rule of L'Hopital twice.
To compute the second derivative at $t=0$ we look at the limit
$$ \begin{align*} &\lim\limits_{t\to0}\frac{\frac{t\cos(at)-\sin(at)}{at^2}-0}{t}=\lim\limits_{t\to0}\frac{t\cos(at)-\sin(at)}{at^3}=\infty??? \end{align*} $$
Not sure if my second derivative at $t=0$ is correct nor if this is the way to go? How would this result in something like $\frac{a^2}{3}$? Any feedback is welcome!
There is a small mistake in your first derivative: we should have
\begin{align*} \frac{d}{dt} \left( \frac{\sin(at)}{at}\right) &= \frac{at \cos(at) - \sin(at)}{at^2}. \end{align*}
Even with that mistake, I'm not sure where you're getting that \begin{align*} \lim_{t \rightarrow 0} \frac{t \cos(at) - \sin(at)}{at^3} = \infty. \end{align*} After applying L'Hopital's rule twice (and correcting the mistake pointed out at the start), I get $-\frac{a^2}3$ for that limit, which is exactly what it should be to agree with the second moment you found.