What is the cause of surface tension?

Short answer:

Surface tension is the force that resists deformation of a surface of a liquid. (Solids have this too, but that is more complex.) The cohesive forces in a liquid minimize the energy of the liquid by minimizing the surface area. It take force to overcome this cohesion and that results in surface tension.

Microscopic Answer:

The liquid state of a substance is a consequence of the attraction between the molecules of the substance. The individual molecules exert forces on one another pulling molecules together until all the space around each molecule is occupied by another molecule.

At a surface, all the space around a molecule in not occupied by another molecule. This is a consequence of just having a finite number of molecules and hence the material has to end at some surface. The surface molecules are not happy about this, but exist with the remaining attractive forces to those molecules which are nearby.

Simplistic explanations of surface tension are almost always wrong. The wrong explanation implies that there are extra cohesive forces between molecules at a surface so they form some sort of bounding membrane like an elastic balloon filled with air does. In fact, the surface molecules generally experience less cohesion with the material for the simple geometric reason that surface molecules do not have as many nearby molecules with which to share the attractive forces.

To deform a surface, one must create more surface. That requires creating more molecules that have less than the maximum number of neighboring molecules. This means pulling molecules apart and that takes force. The molecules resist this and through a complex cooperative connection of molecular forces one can see and measure the macroscopic tendency of the surface to resist deformation.

Caveat:

1. This explanation is necessarily qualitative and general. One can not easily go from an understanding of forces between molecules to a quantitative prediction of surface tension. It can be done, just not with simple formulae.

2. This explanation does not specifically address the cause of the somewhat large surface tension of water, but the application of the general principle described here does explain water as well as oil and liquids in general.

3. This explanation is often recast in terms of energy which makes it simpler. The fact is that the work required to separate molecules to form more surface is exactly equal to the increase in potential energy of the molecules in the liquid. Work equals force times distance and the forces at the molecular level are the forces of attraction between individual molecules.

4. The constant thermal motion of the molecules is not incorporated in this answer because it all averages out. There are, of course, not individual molecules that just sit at the surface and get moved about when the surface is deformed, but rather there is constant motion and exchange of surface molecules with interior molecules.

5. This discussion assumes only one molecular fluid, where as most of the time one deals with the interface between two fluids or a liquid and a gas or a fluid and a solid. One must, of course, take into account the properties of the material outside of the liquid under discussion, even if outside is only the gaseous phase of the same material. An analysis that involves the difference in the forces experienced by molecules near the surface with molecules in the fluids on either side of the surface gives one an explanation of the interfacial surface tension.
Surface tension preventing a paper clip from submerging. The cohesive forces among liquid molecules are responsible for the phenomenon of surface tension. In the bulk of the liquid, each molecule is pulled equally in every direction by neighboring liquid molecules, resulting in a net force of zero.