Solving with L'Hôpital's rule. What is wrong? L'Hôpital's rule can be used infinitely many times as the limit remains $0/0$. However, this problem does not work with L'Hôpital's rule (I may have counted wrong).
Here it is:
$$\lim _{x\to 0}\left(\frac{\left(e^x+\sin x\right)x+e^x-\cos x}{x^2}\right)$$
We use L'Hôpital's rule once:
$$\lim _{x\to 0}\left(\frac{2\sin x\left(x\right)+x\left(\cos\left(x\right)+e^x\right)+2e^x}{2x}\right)$$
One more time:
$$\left(\frac{−x\sin\left(x\right)+3\cos\left(x\right)+\left(x+3\right)e^x}{2}\right)$$
This will equal to $3$. But the real answer is $1$:
$$\lim _{x\to 0}\left(\frac{\left(e^x+\sin x\right)x+e^x-\cos x}{x^2}\right)=1$$
$3$ is not equal to $1$
Thoughts?

You can't apply l'Hôpital on a non indeterminate form.
Let's see what happens with a Taylor expansion at degree $2$:
\begin{align}
(e^x+\sin x)x+e^x-\cos x
&=(1+x+x+o(x))x+1+x+\frac{x^2}{2}-1+\frac{x^2}{2}+o(x^2) \\
&=x+2x^2+x+x^2+o(x^2)\\
&=2x+3x^2+o(x^2)
\end{align}
Thus we see that the given limit cannot be finite (and indeed it is $-\infty$ from the left and $\infty$ from the right).
It's also difficult to understand how the given solution could be $1$, unless we do a sign switch:
\begin{align}
(e^x+\sin x)x-e^x+\cos x
&=(1+x+x+o(x))x-1-x-\frac{x^2}{2}+1-\frac{x^2}{2}+o(x^2) \\
&=x+2x^2-x-x^2+o(x^2)\\
&=x^2+o(x^2)
\end{align}
This proves that
$$
\lim_{x\to0}\frac{(e^x+\sin x)x-e^x+\cos x}{x^2}=1
$$
