Another approach that I found worth sharing is using multi-variable calculus. However, you should further check the conditions on multi-variable limits. Although the solution involves differentiation, but it's not due to the L'Hospital's rule.
Let's define $f(u)$ and $g(x,y)$ as
$$f(u)=\cos{(a_1u)}\cdot\cos{(a_2u)}\cdot\ldots\cdot\cos{(a_nu)} =\prod_{i=1}^{n}{\cos(a_iu)}\\ g(x,y)=\frac{f(y)-f(x)}{x^2-y^2}$$
You can easily verify that the limit $L$ in the question, i.e., $$L=\lim_{x\to0}{\frac{1-f(x)}{x^2}}$$ is equivalent to this double-limit form $$L=\lim_{x\to0}{\lim_{y\to0}{g(x,y)}}$$ because the inner limit comes out as $(1-f(x))/x^2$. Now, assuming $g(x,y)$ has a limit at $(0,0)$, the path to reach $(0,0)$ should not matter, we use another path as this $$L=\lim_{y\to0}{\lim_{x\to y}{g(x,y)}}$$ Therefore
\begin{aligned}
L&=\lim_{y\to0}{\lim_{x\to y}{g(x,y)}}\\
&=\lim_{y\to0}{\lim_{x\to y}{\frac{f(y)-f(x)}{x^2-y^2}}}\\
&=\lim_{y\to0}{\lim_{x\to y}{\frac{f(y)-f(x)}{x-y}\frac1{x+y}}}\\
&=\lim_{y\to0}{\left( \lim_{x\to y}{\frac{f(y)-f(x)}{x-y}}\lim_{x\to y}{\frac1{x+y}} \right)}\\
\end{aligned}
The first limit inside the bracket is (by definition) of $-f'(y)$ and the second one equals $1/2y$. So, $L$ would be $$L=-\lim_{y\to0}{\frac{f'(y)}{2y}}$$
The only thing is to find $f'(u)$. Using the differrntiation rule for products gets $$f'(u)=-\sum_{i=1}^{n}{\left(a_i\sin{(a_iu)} \prod_{j=1}^{n}\frac{\cos(a_ju)}{\cos(a_iu)}\right)}$$ By replacing this into the limit we'll have
\begin{aligned} L&=\lim_{y\to0}{\sum_{i=1}^{n}{\left(\frac{a_i\sin{(a_iy)}}{2y} \prod_{j=1}^{n}\frac{\cos(a_jy)}{\cos(a_iy)}\right)}} \\
&= \sum_{i=1}^{n}{\left( \lim_{y\to0}{\frac{a_i\sin{(a_iy)}}{2y}}\lim_{y\to0}{\prod_{j=1}^{n}\frac{\cos(a_jy)}{\cos(a_iy)}} \right)}
\end{aligned}
The first limit equals $a_i^2/2$ and the second one is $1$. Finally, $L$ is $$L=\frac12\sum_{i=1}^{n}{a_i^2}$$