Due to the cohesive forces, a molecule located away from the surface is pulled equally in every direction by neighboring liquid molecules, resulting in a net force of zero. The molecules at the surface do not have the same molecules on all sides of them and therefore are pulled inward. This creates some internal pressure and forces liquid surfaces to contract to the minimum area.
There is also a tension parallel to the surface at the liquid-air interface which will resist an external force, due to the cohesive nature of water molecules.
The forces of attraction acting between molecules of the same type are called cohesive forces, while those acting between molecules of different types are called adhesive forces. The balance between the cohesion of the liquid and its adhesion to the material of the container determines the degree of wetting, the contact angle, and the shape of meniscus. When cohesion dominates (specifically, adhesion energy is less than half of cohesion energy) the wetting is low and the meniscus is convex at a vertical wall (as for mercury in a glass container). On the other hand, when adhesion dominates (when adhesion energy is more than half of cohesion energy) the wetting is high and the similar meniscus is concave (as in water in a glass).
Surface tension is responsible for the shape of liquid droplets. Although easily deformed, droplets of water tend to be pulled into a spherical shape by the imbalance in cohesive forces of the surface layer. In the absence of other forces, drops of virtually all liquids would be approximately spherical. The spherical shape minimizes the necessary "wall tension" of the surface layer according to Laplace's law.
Another way to view surface tension is in terms of energy. A molecule in contact with a neighbor is in a lower state of energy than if it were alone. The interior molecules have as many neighbors as they can possibly have, but the boundary molecules are missing neighbors (compared to interior molecules) and therefore have higher energy. For the liquid to minimize its energy state, the number of higher energy boundary molecules must be minimized. The minimized number of boundary molecules results in a minimal surface area.
As a result of surface area minimization, a surface will assume a smooth shape.