Let KL be the free surface of a liquid contained in a beaker. Every two molecules of the liquid will attract each other due to the cohesive forces between them. The distance up to which this force is effective is called the molecular range and a sphere whose radius is equal to this molecular range is known as the sphere of influence. Any other molecule in the vicinity of this molecule within the molecular range will experience a force of attraction. Now, let us imagine another plane MN lying parallel below the surface KL. The amount of liquid in between these two layers is called the surface film.
A molecule P lying deep inside the liquid will have its sphere of influence completely surrounded by other molecules and hence the net force on P is zero. Similarly, any molecule on or below MN experience no resultant force. For molecule R, which lies in between KL and MN, the downward force is higher than the upward force and hence the resultant force is in the downward direction. Now, if a molecule is to be raised up, work has to be done against this force. This work done is stored as potential energy of the molecule. Molecule S lying exactly on the surface KL experiences maximum downward force and hence has maximum potential energy. Since every system in equilibrium tries to have minimum potential energy, surface film will also try to attain minimum possible potential energy. Potential energy can be minimized by having minimum surface area. Surface area, for a particular volume, is minimum for a spherical shape. As the surface film tries to acquire a spherical shape, it bends round the corners thus giving rise to a tension in the surface known as surface tension.
Image source: https://www.tutorvista.com