Hardy's inequality (for integrals, I think) presented in Evans' PDE book (pages 296-297) contains a formula whose notation is substantially different than the conventional estimate presentation of $\|F\|_p \leq \frac{p}{p-1} \|f\|_p$.
THEOREM 7 (Hardy's inequality). Assume $n \ge 3$ and $r > 0$. Suppose that $u \in H^1(B(0,r))$. $\quad$Then $\frac{u}{|x|} \in L^2(B(0,r))$, with the estimate $$\int_{B(0,r)} \frac{u^2}{|x|^2}\tag{17} dx \le C \int_{B(0,r)} |Du|^2 + \frac{u^2}{r^2} dx.$$ Proof. We may assume $u \in C^\infty(B(0,r))$. Note that $D \left(\frac 1{|x|} \right)=-\frac x{|x|^3}$. Thus \begin{align} \int_{B(0,r)} \frac{u^2}{|x|^2} dx&=-\int_{B(0,r)} u^2 D \left(\frac 1{|x|} \right) \cdot \frac x{|x|} dx \\ &=\int_{B(0,r)} 2uDu \cdot \frac x{|x|^2} + (n-1) \frac{u^2}{|x|^2} \, dx - \int_{\partial B(0,r)} u^2 \nu \cdot \frac x{|x|^2} \, dS. \end{align} Therefore, $$(2-n) \int_{B(0,r)} \frac{u^2}{|x|^2} dx= 2 \int_{B(0,r)} uDu \cdot \frac x{|x|^2} dx - \frac 1r \int_{\partial B(0,r)} u^2 dS.$$
The proof continues in the book, but my question is how is the last equality derived? I tried multiplying the second-to-last equality by $2-n$ on both sides, but it's not an easy derivation...
Observe that $$\int_{\partial B(0,r)} u^2 \nu \cdot \frac x{|x|^2} \, dS = \frac{1}{r}\int_{\partial B(0,r)} u^2 \, dS $$ because $\nu$ is pointing in the direction of $x$, which makes $\nu\cdot x = |x|$.
After you plug this into the equation before "therefore", all that's left to do is to rearrange the term. The integral with $u^2/|x|^2$ goes to the left where it's combined with another integral of that form. Since $1-(n-1) = 2-n$, you get the left hand side of the last line.
Also, you have a more difficult step waiting for you in this proof: see A technical step in proving Hardy's inequality