This is an excerpt from Shapiro, "Introduction to the theory of numbers":
Suppose that we have an estimate of the form $$|R(x)|\le \alpha x$$ valid for all sufficiently large $x$ (say $x\ge x_2$). Using this estimate in the form $$\left|R\left(\frac xn\right)\right|\le\alpha\frac xn,$$ valid for $x/n\ge x_2$, or $n\le x/x_2$, on the right of (10.6.15) we have that this is $$\le 2\alpha\sum_{n\le x/x_2}\frac xn\log n+\sum_{x/x_2<n\le x}O\left(\frac{x\log n}{n}\right)+O(x\log x),$$ so that we get $$|R(x)|\log^2 x\le\alpha x\log^2x+O(x\log x).$$
The context has $R(x)=\psi(x)-x$, the residual of the second Chebvshev function, and (10.6.15) says $$|R(x)|\log^2 x\le2\sum_{n\le x}\left|R\left(\frac xn\right)\right|\log n+O(x\log x).$$ The above derivation also makes use of the previously proven $R(x)=O(x)$, that is, $|R(x)|\le Ax$ for some $A$ and all $x$.
The part I can't figure out is what happened to the factor of $2$ in the last line. The best I have come up with is:
\begin{align} |R(x)|\log^2 x&\le2\sum_{n\le x}\left|R\left(\frac xn\right)\right|\log n+O(x\log x)\\ &=2\sum_{n\le x/x_2}\left|R\left(\frac xn\right)\right|\log n+2\sum_{x/x_2<n\le x}\left|R\left(\frac xn\right)\right|\log n+O(x\log x)\\ &\le 2\alpha\sum_{n\le x/x_2}\frac xn\log n+2A\sum_{x/x_2<n\le x}\frac xn\log n+O(x\log x)\\ &\le 2\alpha\sum_{n\le x/x_2}\frac xn\log x+2A\sum_{x/x_2<n\le x}\frac xn\log x+O(x\log x)\\ &=2\alpha x\log x(\log x-\log x_2+O(1))+2Ax\log x(\log x_2+O(1))+O(x\log x)\\ &=2\alpha x\log^2 x+O(x\log x).\\ \end{align}
In the penultimate step, I use the estimate $\sum_{a<n\le b}\frac 1n=\log b-\log a+O(1)$.
Note that this factor is absolutely critical to the argument: later steps improve this estimate to $|R(x)|\log^2 x\le (\alpha-\epsilon)x\log^2 x+O(x\log x)$ for $\epsilon\ll\alpha$ by careful analysis of some of the terms in this sum, so that $|R(x)|\le (\alpha-\epsilon)x$, and $\epsilon$ is large enough that repeating this process leads to estimates $\alpha$ approaching $0$ and thus $R(x)=o(x)$ which is the PNT.
Sum of $(\log n)/n$ ~ integral $\int (\log n / n) dn = (\log n)^2 / 2$. This removes a factor of $2$ from the first and largest term.
Edit (Mario): Summation by parts with $f_n=g_n=H_{n-1}$ gives
$$\sum_{n\le a}\frac{H_{n-1}}{n}=H_a^2-\sum_{n\le a}\frac{H_n}{n}\implies\sum_{n\le a}\frac{H_{n-1}}{n}\le\frac12 H_a^2.$$
Using $\log(n+1)\le H_n\le\log n+1$, we have $$\sum_{n\le a}\frac{\log n}{n}\le\sum_{n\le a}\frac{H_{n-1}}{n}\le\frac12 H_a^2\le \frac12\log^2a+\log a+\frac12=\frac12\log^2a+O(\log a)$$ for $a\ge 1$.