If $\sum_{i=1}^{n} a_{i}^2 =1$, then $\int_{0}^{1}\vert a_{0}+\cdots + a_{n}x^{n}\vert\text{d}x\le\frac{\pi}{2}$ This is Exercise 3 of Chapter 3 in G.P. Tolstov's Fourer Series (1976).

If $P\left(x\right)=a_0+a_{1}\left(x\right)+\cdots+a_{n}x^{n}$ is a polynomial satisfying $\sum_{i=0}^{n} a_{i}^2=1$, then $$\int_{0}^{1}\vert P\left(x\right)\vert\text{d}x\le\frac{\pi}{2}.$$ [Show that the inequality continues to hold of the upper bound is replaced with $\pi/\sqrt{6}$.]

Up to this point, Bessel's inequality and Schwarz's inequality have been provided. My work is provided below, but I am skeptical because (i) my upper bound does not involve $\pi$ and (ii) my upper bound of $1$ is better than $\pi/\sqrt{6} \approx 1.28$. Below is the work followed by the reasoning. Why does $\pi$ appear in the author's inequality?
\begin{align*}
\int_{0}^{1}\left|P\left(x\right)\right|\text{d}x & =\int_{0}^{1}\left|a_{0}+a_{1}x+\cdots+a_{n}x^{n}\right|\text{d}x\\
 & \le\int_{0}^{1}\left(\left|a_{0}\right|+\cdots+\left|a_{n}\right|\right)\\
 & \le\int_{0}^{1}\left(\left|a_{0}\right|+\cdots+\left|a_{n}\right|\right)\left(1+0+\cdots+0\right)\text{d}x\\
 & \le\int_{0}^{1}\sqrt{\left(\left|a_{0}\right|^{2}+\cdots+\left|a_{n}\right|^{2}\right)\left(1^{2}+0^{2}+\cdots+0^{2}\right)}\\
 & =\int_{0}^{1}1\text{dx}\\
 & =1.
\end{align*}
The first inequality is due to the triangle inequality and fact that the interval of integration is  between  $-1$ and $1$, and  the third inequality is due to the Cauchy-Schwarz inequality. The second-to-last equation follows from the assumption that the sum of the squares of the $a_{i}$'s is $1$.
 A: By hypothesis, we have
$$
a_0^2+\cdots+a_n^2=1
$$
As noted in the comments, your error is your assertion that
$$
|a_0|+\cdots+|a_n| \le \sqrt{|a_0|^2+\cdots+|a_n|^2}
$$
follows from the Cauchy-Schwarz inequality.

As a simple counterexample, for $n=1$, letting $a_0={\large{\frac{4}{5}}}$ and $a_1={\large{\frac{3}{5}}}$, we get
$$
|a_0|+|a_1|
=
\frac{7}{5} > 1
=
\sqrt{|a_0|^2+|a_1|^2}
$$
and also
$$
\left|\int_0^1 a_0+a_1x\right|=\frac{11}{10} > 1
$$
As regards the exercise in question, it can be resolved as follows . . .
\begin{align*}
&
\left|\int_0^1 \sum_{k=0}^n a_kx^k\right|
\\[4pt]
\le\;&
\int_0^1 \sum_{k=0}^n |a_k|x^k
\\[4pt]
=\;&
\sum_{k=0}^n \frac{|a_k|}{k+1}
\\[4pt]
\le\;&
\left(\sqrt{\sum_{k=0}^n a_k^2}\right)
\left(\sqrt{\sum_{k=0}^n \frac{1}{(k+1)^2}}\right)
\\[4pt]
=\;&
\sqrt{\sum_{k=0}^n \frac{1}{(k+1)^2}}
\\[4pt]
=\;&
\sqrt{\sum_{k=1}^{n+1} \frac{1}{k^2}}
\\[4pt]
 < \;&
\sqrt{\sum_{k=1}^\infty \frac{1}{k^2}}
\\[4pt]
=\;&
\sqrt{\frac{\pi^2}{6}}
\\[4pt]
=\;&
\frac{\pi}{\sqrt{6}}
\\[4pt]
 < \;&
\frac{\pi}{2}
\\[4pt]
\end{align*}
