How can Van der Waals forces be either attractive or repulsive?
Van der Waals forces may be attractive or repulsive, depending on the distance between the molecules involved.
Recall that Van der Waals forces generally refer to intermolecular forces . These forces are generally attractive at normal pressures. You can review H-bond, dipole dipole, dispersion, ion-dipole forces, etc for how these forces are attractive.
However at extremely high pressures the molecules are so close to each other that their atoms' positive nuclei will repel, and this repulsive force will exceed the attractive force from the dipole, dispersion or H-bond attraction.
Whether the force is attractive, repulsive, or non-existent (ideal gases), will depend on the sum of the attractive forces vs. the repulsive forces. If the sum of the attractive forces exceeds the sum of the repulsive forces, the molecules will attract. If the opposite is true, the molecules will repel.
There is no need for calculation of individual forces, rather, you should just be aware that as molecules approach one another they initially attract one another by one of the above forces, and as the get even closer, they will generally repel as protons in neighboring molecules get to close to each other.
This image shows how attractive dispersion forces set up in atomic substances. The image below represents a helium atom. As a helium atom approaches another, a temporary dipole in one atom can induce a dipole in a nearby atom, and an attractive force can set up. This happens in molecular substances too.
If we kept pushing these atoms closer and closer, eventually the two nuclei would be close enough to repel, and as they are brought even closer (very high pressure), the repulsive force would overcome the dispersion force. PV/RT > 1