Finding (∂U/∂V )T = n^2a/V^2 for a van der Waals gas
The more general equation you are looking for is called the thermodynamic equation of state. You can start from the differential form of U according to the 1st + 2nd laws of thermodynamics for pV work only:

$$dU = TdS-pdV$$

Taking the derivative wrt V at constant T 

$$\left(\frac{\partial U}{\partial V}\right)_T= T \left(\frac{\partial S}{\partial V}\right)_T-p$$

At this point you want to use the Maxwell relation

$$\left(\frac{\partial p}{\partial T}\right)_V= \left(\frac{\partial S}{\partial V}\right)_T$$

(which follows from the Helmholtz energy being a state function) so that

$$\left(\frac{\partial U}{\partial V}\right)_T= T \left(\frac{\partial p}{\partial T}\right)_V-p \tag{tes}$$

This last expression is the thermodynamic equation of state.

The final step is to evaluate $\left(\frac{\partial p}{\partial T}\right)_V$ for the van der Waals equation of state.