Derivation of work done by real gas
For a reversible process in a closed system (no mass entering or leaving), the general equation for the expansion work done by a real gas on the surroundings is the same for an ideal gas, namely 
$$W = \int p\,\mathrm{d}V$$
However, for a real gas, we use the equation of state for that gas $p=p(n,V,T)$ rather than $p=\frac{nRT}{V}$, the equation of state for the ideal gas.