I'm following the derivation of the fundamental solution to Laplace's equation in section 2.2.1 of Evans's PDE book.
It's the standard approach. We assume a radially symmetric solution $v(r)$ and do the necessary substitution for $r = |x| = (x_1^2 + \dots + x_n^2)^{1/2}$ in $u(x)$.
I understand why $u_{x_i} = v'(r)\frac{x_i}{r}$, but the book says $u_{x_ix_i} = v''(r) \frac{x_i^2}{r^2} + v'(r)\left(\frac{1}{r} - \frac{x_i^2}{r^3}\right)$, and I'm not sure how we produce the final $\frac{x_i^2}{r^3}$ term after applying the chain and product rules.
This comes from differentiating $x_i/r$ (which stands next to $v'(r)$ in the first derivative $u'_{x_i}$), when you use the product rule. With $r=(x_1^2+\cdots+x_i^2+\cdots+x_n^2)^{1/2}$, the quotient rule gives $$ \frac{\partial}{\partial x_i}\frac{x_i}{r}=\frac{1\cdot r-x_i \cdot r'_{x_i}}{r^2}. $$ Now, $$ r'_{x_i}=\frac{1}{2}=(x_1^2+\cdots+x_i^2+\cdots+x_n^2)^{-1/2}\cdot (2x_i)=\frac{x_i}{r}, $$ so $$ \frac{\partial}{\partial x_i}\frac{x_i}{r}=\frac{1}{r}-\frac{x_i^2}{r^3}. $$
PS: Are you missing a square on the $r$ in the part with the second derivative?