Why do we need to check for more than $\frac{\infty}{\infty}$ or $\frac{0}{0}$ when applying L'Hospital?
For the sake of the argument I'll use a question from an exam and combine two solutions ("real solutions" as in those were handed in by students) that will point out common mistakes when applying L'Hospital's rule. The exam was taken by students in their first semester of university.
Question: Determine the following limit (if it exists): $$\lim\limits_{x\to\infty}\frac{x-\sin(x)}{x+\sin(x)}$$
Wrong solution: we have $\lim\limits_{x\to\infty}(x-\sin(x))=\lim\limits_{x\to\infty}(x+\sin(x))=\infty$, thus by applying L'Hospital's rule we get: $$\lim\limits_{x\to\infty} \frac{x-\sin(x)}{x+\sin(x)}=\lim\limits_{x\to\infty}\frac{1-\cos(x)}{1+\cos(x)}.$$ For this limit we get an indeterminate form as well, so applying L'Hospital's rule again yields $$\lim\limits_{x\to\infty} \frac{x-\sin(x)}{x+\sin(x)}=\lim\limits_{x\to\infty}\frac{1-\cos(x)}{1+\cos(x)}=\lim\limits_{x\to\infty}\frac{\sin(x)}{-\sin(x)}=-1.$$
The solution $\lim\limits_{x\to\infty}\frac{x-\sin(x)}{x+\sin(x)}=-1$ and the solution process are completely wrong. First of all one can show, that $$\frac{x-\sin(x)}{x+\sin(x)}\geq 0$$ for all $x\in\mathbb R\setminus\{0\}$; thus the limit (if it exists) can't be negative. For analyzing the mistakes, we first need to look up, what L'Hospital's rule really says:
Let $a,b\in\mathbb R\cup\{-\infty,\infty\},a<b$. Let $f:(a,b)\rightarrow\mathbb R$ and $g:(a,b)\rightarrow\mathbb R$ be differentiable with $g'(x)\neq 0$ for all $x\in(a,b)$. Then the following holds:
If $\lim\limits_{x\uparrow b}f(x)=\lim\limits_{x\uparrow b}g(x)=A\in\{0,-\infty,\infty\}$ and $\lim\limits_{x\uparrow b} \frac{f'(x)}{g'(x)}=L\in\mathbb R\cup\{-\infty,\infty\}$ exists, then $\lim\limits_{x\uparrow b} \frac{f(x)}{g(x)}=L$.
A similar argument holds for $\lim\limits_{x\downarrow a}\frac{f(x)}{g(x)}$.
The requirements of $f,g$ being differentiable functions etc. were never checked in the solution. Now let's look at the applications of L'Hospital's rule.
First application: $\displaystyle\lim\limits_{x\to\infty} \frac{x-\sin(x)}{x+\sin(x)}=\lim\limits_{x\to\infty} \frac{1-\cos(x)}{1+\cos(x)}$
We check if we can apply L'Hospital's rule. First of all we need to define $$f:(0,\infty)\rightarrow\mathbb R,x\mapsto x-\sin(x)~\text{and}~g:(0,\infty)\rightarrow\mathbb R,x\mapsto x+\sin(x).$$ Then $f$ and $g$ are differentiable and $\displaystyle\frac{f(x)}{g(x)}$ is well-defined as $g(x)\neq 0$ for $x\in(0,\infty)$.
We also have $\lim\limits_{x\to\infty}(x-\sin(x))=\lim\limits_{x\to\infty}(x+\sin(x))=\infty$. But we must not apply L'Hospital's rule, as we don't have $g'(x)\neq 0$ for $x\in (0,\infty)$:
with $g'(x)=1+\cos(x)$ we have $$g'(x)=0 \Leftrightarrow \cos(x)=-1 \Leftrightarrow x=\pi+2\pi k,k\in\mathbb Z.$$ As $\pi\in (0,\infty)$, we don't have $g'(x)\neq 0$ for all $x\in(0,\infty)$.
One might now try to shift the lower endpoint of the interval $(0,\infty)$ up; as we're looking at $x\to\infty$, the lower endpoint of the interval doesn't really matter. So let's define $f,g:(4,\infty)\rightarrow\mathbb R$, this way we remove $\pi$ from the domain of $g$ and $g'$. But we still get $g'(3\pi)=0$ with $3\pi\in (4,\infty)$. No matter on which interval $(a,\infty)$ we define $f$ and $g$, we will always find $k\in\mathbb Z$ with $\pi+2\pi k>a$ and therefore $g'(\pi+2\pi k)=0$. Thus the first application of L'Hospital's rule in the solution is wrong.
Second application: $\displaystyle \lim\limits_{x\to\infty}\frac{1-\cos(x)}{1+\cos(x)}=\lim\limits_{x\to\infty}\frac{\sin(x)}{-\sin(x)}$
First of all we'd need to define $$f:(a,\infty)\rightarrow \mathbb R,x\mapsto 1-\cos(x)~\text{and}~g:(a,\infty)\rightarrow\mathbb R,x\mapsto 1+\cos(x).$$ Then with $g'(x)=-\sin(x)$ we'd have the same problem as in the first application: $$g'(x)=0\Leftrightarrow x=\pi k,k\in\mathbb Z.$$ But there is another mistake, that (at least in my experience) often happens when trying to apply L'Hospital's rule.
The limit $\lim\limits_{x\to\infty} \frac{1-\cos(x)}{1+\cos(x)}$ is not of the indeterminate form $\frac{A}{A}$ with $A\in\{0,\pm\infty\}$. For the application of L'Hospital's rule this is a necessary condition.
Yes, the limit $\lim\limits_{x\to\infty} \frac{1-\cos(x)}{1+\cos(x)}$ is of some indeterminate form, but it doesn't fit L'Hospital's rule. So just because a limit is of an indeterminate form, one can't simply apply L'Hospital's rule.
L'Hospital's rule does need more than just $\frac{0}{0}$ or $\frac{\infty}{\infty}$ to be applicable and it is important to at least think about the requirements when using it. Often there are other ways to get to the right answer without using L'Hospital's rule which in my opinion should be considered first.
As a last point, one right solution to calculate the limit:
For $x\neq 0$ we have: $$\frac{x-\sin(x)}{x+\sin(x)}=\frac{x\left(1-\frac{\sin(x)}{x}\right)}{x\left(1+\frac{\sin(x)}{x}\right)}=\frac{1-\frac{\sin(x)}{x}}{1+\frac{\sin(x)}{x}}.$$ Because $|\sin(x)|\leq 1$ we have $-\frac{1}{x}\leq \frac{\sin(x)}{x}\leq \frac{1}{x}$. With $\lim\limits_{x\to\infty} \frac{1}{x}=0$ and the squeeze theorem we get $\lim\limits_{x\to\infty} \frac{\sin(x)}{x}=0$ and thus we have $$\lim\limits \frac{x-\sin(x)}{x+\sin(x)}=\lim\limits_{x\to\infty} \frac{1-\frac{\sin(x)}{x}}{1+\frac{\sin(x)}{x}}=1.$$
Edit: as asked by S.Panja-1729 in the comments, one way to show $\lim\limits_{x\to\infty} x+\sin(x)=\infty$.
With $|\sin(x)|\leq 1$ we have $x+\sin(x)\geq x-1$. As $\lim\limits_{x\to\infty} x-1=\infty$ we can conclude $\lim\limits_{x\to\infty} x+\sin(x)=\infty$. A similar argument holds for $\lim\limits_{x\to\infty} x-\sin(x)=\infty$.
To point out another mistake when using L'Hospital's rule (as suggested by Andrew D. Hwang in the comments):
Question: Determine the following limit (it it exists): $$\lim_{x \to \infty} \frac{x - \frac{1}{2}\sin(x)}{x + \frac{1}{2} \sin(x)}$$
Wrong solution: we have $\lim\limits_{x\to\infty} \left( x-\frac{1}{2}\sin(x) \right)=\lim\limits_{x\to\infty} \left(x+\frac{1}{2}\sin(x) \right)=\infty$, thus by applying L'Hospital's rule we get $$\lim_{x \to \infty} \frac{x - \frac{1}{2}\sin(x)}{x + \frac{1}{2} \sin(x)}=\lim\limits_{x\to\infty}\frac{1-\frac{1}{2}\cos(x)}{1+\frac{1}{2}\cos(x)}.$$ As $$\lim\limits_{x\to\infty}\frac{1-\frac{1}{2}\cos(x)}{1+\frac{1}{2}\cos(x)}$$ doesn't exist, we can conclude that $$\lim_{x \to \infty} \frac{x - \frac{1}{2}\sin(x)}{x + \frac{1}{2} \sin(x)}$$ doesn't exist.
For analyzing the mistake, we again check if we can apply L'Hospital's rule.
Let $$f:(0,\infty)\rightarrow \mathbb R,f(x)=x - \frac{1}{2}\sin(x),~g:(0,\infty)\rightarrow\mathbb R,g(x)=x + \frac{1}{2} \sin(x).$$ Then $f$ and $g$ are differentiable and $\displaystyle\frac{f(x)}{g(x)}$ is well-defined, as $g(x)\neq 0$ for $x\in(0,\infty)$. Futhermore, with $g'(x)=1+\frac{1}{2}\sin(x)$ we have $g'(x)\neq 0$ for $x\in (0,\infty)$, thus $\displaystyle \frac{f'(x)}{g'(x)}$ is well-defined. But we still can't apply L'Hospital's rule as the last requirement is not fulfilled.
For applying L'Hospital's rule it is necessary, that the limit $$\lim\limits_{x\uparrow b} \frac{f'(x)}{g'(x)}$$ exists either as a real number, meaning that $\displaystyle\frac{f'(x)}{g'(x)}$ converges to $L\in\mathbb R$ as $x$ approaches $b$, or the limit exists as $\pm\infty$, meaning that $\displaystyle\frac{f'(x)}{g'(x)}$ diverges (strictly) to $\infty$ or $-\infty$ as $x$ approaches $b$. Only in this case can we identify the limit $$\lim\limits_{x\uparrow b}\frac{f'(x)}{g'(x)}$$ with $$\lim\limits_{x\uparrow b}\frac{f(x)}{g(x)}.$$
In our question we get $$\lim\limits_{x\to\infty}\frac{1-\frac{1}{2}\cos(x)}{1+\frac{1}{2}\cos(x)}$$ which neither converges to $L\in\mathbb R$ nor does it (strictly) diverge to $\infty$ or $-\infty$. Thus we can't apply L'Hospital's rule.
To get the correct answer, we can use the same argument we have used for the first question and get: $$\lim\limits_{x\to\infty}\frac{x-\frac{1}{2}\sin(x)}{x+\frac{1}{2}\sin(x)}=\lim\limits_{x\to\infty}\frac {1-\frac{1}{2}\cdot \frac{\sin(x)}{x}}{1+\frac{1}{2}\cdot\frac{\sin(x)}{x}}=1.$$
Questions, comments, corrections etc. are appreciated.