Let $f(x)$ denote the egregious fraction of sines inside the square. Writing $w = e^{2ix}$, we have
\begin{align*}
f(x)
&:= \frac{(\sin 2x)(\sin 3x)(\sin 5x)(\sin 30x)}{(\sin x)(\sin 6x)(\sin 10x)(\sin 15x)} \\
&= w^{-4} \underbrace{ \frac{(w^2 - 1)(w^3 - 1)(w^5 - 1)(w^{30} - 1)}{(w - 1)(w^6 - 1)(w^{10} - 1)(w^{15} - 1)} }_{=:g(w)}.
\end{align*}
Writing the fraction part in the last line as $g(w)$, algebraic manipulation using the finite geometric series formula yields
\begin{align*}
g(w)
= \frac{(w + 1)(w^{15} + 1)}{(w^3 + 1)(w^5 + 1)}
= \frac{w^{10} - w^5 + 1}{w^2 - w + 1}
= w^8 + w^7 - w^5 - w^4 - w^3 + w + 1,
\end{align*}
where we utilized the long division in the last step.1) Now, we write
$$ g(w) = \sum_{k\geq 0} a_k w^k $$
for simplicity. Then by noting that $f(x)$ is real-valued,
\begin{align*}
\int_{0}^{\pi} f(x)^2 \, \mathrm{d}x
&= \int_{0}^{\pi} f(x)\overline{f(x)} \, \mathrm{d}x \\
&= \int_{0}^{\pi} \left( e^{-8ix} g(e^{2ix}) \right) \overline{\left( e^{-8ix} g(e^{2ix}) \right)} \, \mathrm{d}x \\
&= \sum_{j,k} a_j \overline{a_k} \int_{0}^{\pi} e^{2ix(j-k)} \, \mathrm{d}x \\
&= \pi \sum_{k \geq 0} |a_k|^2 \\
&= 7\pi.
\end{align*}
1) Alternatively, if OP is familiar with some abstract algebra, we can proceed as below:
\begin{align*}
g(w)
= \prod_{d \mid 30} (w^d - 1)^{\mu(30/d)}
= \Phi_{30}(w)
= w^8 + w^7 - w^5 - w^4 - w^3 + w + 1,
\end{align*}
where $\mu$ is the Möbius function and $\Phi_n$ is the cyclotomic polynomial.
First, factor the integrand:
$$\frac{x^6+x^4-x^2-1}{x^4}=\frac{(x^4-1)(x^2+1)}{x^4}=\left(\frac{x^2+1}{x}\right)^2\left(1-\frac1{x^2}\right).$$
Now, let $y=x+1/x$; we have $dy=(1-1/x^2)dx$, so our integral becomes
$$\int \left(\frac{x^2+1}{x}\right)^2e^ydy=\int y^2e^ydy.$$
A standard integration by parts gives
$$\int y^2e^ydy=(y^2-2y+2)e^y+C,$$
so we have the answer
$$\left(\left(x+\frac1x\right)^2-2\left(x+\frac1x\right)+2\right)e^{x+1/x}+C.$$
Best Answer
The key idea in this question is that one should know how to break the integral into appropriate parts so that it's clear what is going on.
Indeed, the identification of indices is correct. However, the signs haven't been specified yet. To make things precise, I'll start over again.
The set of "exponents" $S$ is clearly equal to all positive integers whose decimal representation consists only of $0$ and $9$, such as $990, 9099$ etc.
Now, if the last digit of $S$ is a $9$ then the sign is positive (and the resulting monomial is multiplied by $9$) , otherwise the sign is negative.
One is tempted to take the positive and negative parts aside : if one does this, though, then you truly lose sight of what is the key step here.
The key step here is the recognition that $$ \frac{1}{9} = \sum_{i=1}^{\infty} \frac{1}{10^i} $$ and therefore, $$ 1 =\sum_{i=1}^{\infty} \frac{9}{10^i} = \sum_{i=1}^{\infty} \int_0^1 9x^{10^i-1}dx $$
This shows you how combining some of the powers in the sum above might result in the number $1$. However, we can easily combine this to "cover" other powers as well. Indeed, for any positive integer $s$, \begin{equation} \int_0^1 x^{s}dx = \frac{1}{s+1} = \sum_{i=1}^{\infty} \frac{9}{(s+1)10^i} = \sum_{i=1}^{\infty} \int_0^1 9x^{(s+1)10^i-1}dx \tag{1} \label{1} \end{equation} Let's see how this looks on paper. Take $s = 90$. Then, this looks like $$ \int_{0}^1 x^{90}dx = \int_0^1 (9x^{909} +9x^{9099}+9x^{90999}+\ldots) $$ Then let's look at $s = 990$. This looks like $$ \int_0^1 x^{990}dx = \int_0^1 (9x^{9909}+9x^{99099}+9x^{990999} + \ldots) $$
and you can see where this is going! If you make this observation within two minutes of the clock elapsing on this problem, you should be done before the buzzer, provided you can formalize things.
Naturally, the formalization is quite easy now. Let $S' \subset S$ be all those exponents ending in a $0$.
Then, summing $\eqref{1}$ over $s\in S'$, we have \begin{equation} \int_0^1 \sum_{s \in S'} x^{s}dx = \int_0^1 \sum_{s\in S'} \sum_{i=1}^{\infty} 9x^{(s+1)10^i-1}dx \tag{2}\label{2} \end{equation}
However, observe that every number of the form $(s+1)10^i-1, s \in S', i \geq 1$ is in one-to-one correspondence with an exponent in $S\setminus S'$, that does NOT have all its digits as $9$. For example
If you take $90909$ then this equals $90910-1 = (9090+1)10-1$ which corresponds to $s = 9090,i=1$.
If you take $90099999$ then this equals $90100000-1 = (900+1)10^5 - 1$ which corresponds to $s = 900, i=5$.
A visual way of describing this bijection is that you take the number in question, find the number of nines it ends with (which equals $i$), remove all those to get the number $s$). For example, $90099999$ ends with $i=5$ nines and removing them gives $s=900$.
This way, \eqref{2} rearranges itself to \begin{equation} \int_0^1 \left(\sum_{s \in S'} x^{s}dx - \sum_{s\in S'} \sum_{i=1}^{\infty} 9x^{(s+1)10^i-1}\right)dx =0\tag{3}\label{3} \end{equation}
By the previous observations and $\eqref{3}$, all those exponents $S$ in the integral to be computed cancel out, except those that only contain $9$ as a digit. Consequently, $$ I= \int_0^1 \left(9x^9 - x^{90}+9x^{99} - x^{900} +9x^{909} - x^{990} + 9x^{999} - x^{9000} + \ldots\right) dx \\ = \int_0^1 9x^9+9x^{99}+9x^{999} + \ldots dx \\ = \sum_{i=1}^{\infty} \frac{9}{10^i} = 1 $$ by the geometric series , concluding the proof.
I think it's important to notice how the integral was broken up. Simply combining the positive signs blindly, or combining all monomials with exponents having the same number of digits etc., these are all blind alleys to some extent. Therefore, having the right approach, and having it in three minutes at that, it's quite incredible (read the comment below the question).
Also note that I have freely exchanged integral and sum everywhere, and I'm not going to justify Fubini's theorem being used here, it probably can be used quite liberally without proof in competitions.