I know that : $$\int_{B_r(0)}\frac{1}{|y|^{n-2}}\;dy=\int_{0}^r\left (\int_{\partial B_r(0)}\frac{1}{\lvert y \rvert^{n-2}}\;dS\right)\;dr,$$ where $B_r(0)\subseteq\mathbb{R}^n$ is the ball of radius $r$ and center $0$.
Since $\Large \frac{1}{|y|^{n-2}}=\frac{1}{r^{n-2}}$ on $\partial B_r(0)$, then
$$\int_{\partial B_r(0)}\frac{1}{\lvert y \rvert^{n-2}}\;dS=\int_{\partial B_r(0)}\frac{1}{\lvert r \rvert^{n-2}}\;dS.$$
From the solution I see that there must be the multiplicative term $r^{n-1}$.
$\Large\text{My attempt}$
$$\int_{\partial B_r(0)}\frac{1}{\lvert y \rvert^{n-2}}\;dS=\int_{\partial B_r(0)}\frac{1}{\lvert r \rvert^{n-2}}\;dS=\frac{1}{\lvert r^{n-2} \rvert}\int_{\partial B_r(0)}\; dS=n\omega_n\frac{r^{n-1}}{r^{n-2}},$$ where $n\omega_n$ is the area of surface of ball.
Where does this term come from?
This isn't an answer but is too long for a comment. It helps to see what happens in simple (in this case lower dimensional) cases when you get confused by a formula. When $n=2$ the measure $dS$ is the linear measure on a circle, usually denoted by $d\theta$. If you work out both sides you get (in your question you overloaded the symbol $r$ by the way) $$\int_{B_R(0)} \frac{1}{|y|^{2-2}} \, dy = \int_{B_R(0)} \, dy = \pi R^2.$$ On the other hand $$\int_0^R \left( \int_{\partial B_r(0)} \frac{1}{|y|^{2-2}} \, d\theta \right) \, dr = \int_0^R \left( \int_{\partial B_r(0)} \frac{1}{|r|^{2-2}} \, d\theta \right) \, dr = \int_0^R 2\pi r \, dr= \pi R^2.$$ So they agree, contrary to what you thought. As commenter RRL pointed out, when you change variables you have to account for the Jacobian that measures the "stretch" of the transformation. In two dimensions this is the usual formula $dxdy = r drd\theta$.