How to find the limit of $\lim_{x\to 0} \frac{1-\cos^n x}{x^2}$
From l'Hopital's rule ... $$L = \lim_{x\to 0}\frac{1-\cos^n x}{x^2} = \lim_{x\to 0}\frac{n\sin x\cos^{n-1}x}{2x} = \lim_{x\to 0}\frac n2\left(\frac{\sin x}x\right)\left(\cos^{n-1}x\right) = \cdots$$
Here, we use an approach that is more efficient and more elementary than use of L'Hospital's Rule.
Simply factor the term $1-\cos^n(x)$ as
$$1-\cos^n(x)=(1-\cos(x))\sum_{m=0}^{n-1}\cos^m(x)$$
Then, we have
$$\begin{align} \lim_{x\to 0}\frac{1-\cos^n(x)}{x^2}&=\lim_{x\to 0}\frac{1-\cos(x)}{x^2}\sum_{m=0}^{n-1}\cos^m(x)\\\\ &\lim_{x\to 0}\frac{1-\cos(x)}{x^2} \lim_{x\to 0} \sum_{m=0}^{n-1}\cos^m(x)\\\\ &=\left(\frac12\right)(n)\\\\ &=\frac n2 \end{align}$$
I have seen several limit problems on MSE where people don't use the standard limit $$\lim_{x \to a}\frac{x^{n} - a^{n}}{x - a} = na^{n - 1}\tag{1}$$ whereas frequent use is made of other standard limits like $$\lim_{x \to 0}\frac{\sin x}{x} = \lim_{x \to 0}\frac{\log(1 + x)}{x} = \lim_{x \to 0}\frac{e^{x} - 1}{x} = 1\tag{2}$$ and this question is also an instance where the limit $(1)$ should be used.
We have \begin{align} L &= \lim_{x \to 0}\frac{1 - \cos^{n}x}{x^{2}}\notag\\ &= \lim_{x \to 0}\frac{1 - \cos^{n}x}{1 - \cos x}\cdot\frac{1 - \cos x}{x^{2}}\notag\\ &= \lim_{x \to 0}\frac{1 - \cos^{n}x}{1 - \cos x}\cdot\lim_{x \to 0}\frac{1 - \cos x}{x^{2}}\notag\\ &= \lim_{t \to 1}\frac{1 - t^{n}}{1 - t}\cdot\lim_{x \to 0}\frac{1 - \cos^{2}x}{x^{2}(1 + \cos x)}\text{ (putting }t = \cos x)\notag\\ &= \lim_{t \to 1}\frac{t^{n} - 1}{t - 1}\cdot\lim_{x \to 0}\frac{\sin^{2}x}{x^{2}}\cdot\frac{1}{1 + \cos x}\notag\\ &= n\cdot 1\cdot\frac{1}{1 + 1}\notag\\ &= \frac{n}{2}\notag \end{align}