We started with the superposition principle for the (electric) scalar potential \begin{eqnarray*} V(\rr) = {1\over 4\pi\epsilon_0} \int {\rho(\rrp)\,d\tau'\over|\rr-\rrp|} \end{eqnarray*} and the corresponding superposition principle for the electric field \begin{eqnarray*} \EE(\rr) = {1\over 4\pi\epsilon_0} \int {\rho(\rrp) (\rr-\rrp)\,d\tau'\over|\rr-\rrp|^3} \end{eqnarray*} But we also have the relation \begin{eqnarray*} \EE = - \grad V \end{eqnarray*} and we could have calculated the above integral representation of $\EE$ by taking the gradient of the one for $V$.
It is fairly easy to see that consistency of the above expressions requires \begin{eqnarray} \grad\left({1\over|\rr-\rrp|}\right) = - \> {\rr-\rrp \over |\rr-\rrp|^3} \label{gradrrp} \end{eqnarray} which can of course also be computed directly. Note that the gradient only “sees” $\rr$, not $\rrp$; we are only taking $x$, $y$, and $z$ derivatives (or their equivalents in curvilinear coordinates), not $x'$, $y'$, or $z'$ derivatives. This also means there is no difficulty bringing the gradient inside the integral sign. Direct verification of this identity is most easily done by writing everything out explicitly in rectangular coordinates.
Starting instead with the vector potential, we have \begin{eqnarray*} \AA(\rr) = {\mu_0\over 4\pi} \int {\rho(\rrp)\,\vv(r')\,d\tau'\over|\rr-\rrp|} = {\mu_0\over 4\pi} \int {\JJ(\rrp)\,d\tau'\over|\rr-\rrp|} \end{eqnarray*} Proceeding by analogy, we can ask what the result would be of differentiating this expression. But $\AA$ is a vector field; how should we differentiate? It turns out that the correct choice is to take the curl. We can move curl inside the integral, and use the product rule for curl. The only dependence on $\rr$ is in the term on the denominator; that's “$f$”. Everything else is “$\GG$”, which is a constant vector field, so that the “$\grad\times\GG$” term is zero. Thus, all we need to do is use the previously derived formula ($\ref{gradrrp}$) for $\grad(1/|\rr-\rrp|)$, resulting in \begin{eqnarray} \grad\times\AA = {\mu_0\over 4\pi} \int {\JJ(\rrp)\times(\rr-\rrp)\,d\tau'\over|\rr-\rrp|^3} \label{BS} \end{eqnarray} (where the minus sign has been removed by reversing the order of the cross product). You should recognize the right-hand side of ($\ref{BS}$) as the Biot-Savart Law for the magnetic field. We have therefore shown that \begin{equation} \BB = \grad\times\AA \end{equation} which justifies having called $\AA$ the (magnetic) vector potential to begin with.
For surface currents, the Biot-Savart Law takes the form \begin{eqnarray*} \BB = {\mu_0\over 4\pi} \int {\KK(\rrp)\times(\rr-\rrp)\,dA'\over|\rr-\rrp|^3} \end{eqnarray*} and for line currents we have \begin{eqnarray*} \BB = {\mu_0\over 4\pi} \int {\II(\rrp)\times(\rr-\rrp)\,ds'\over|\rr-\rrp|^3} = - {\mu_0 I\over 4\pi} \int {(\rr-\rrp)\times d\rrp\over|\rr-\rrp|^3} \end{eqnarray*} since $\II\,ds' = I\,d\rr$. (The order of the cross product is often reversed in the last expression, but this requires the convention that the other factor still be regarded as being inside the integral.)