Try a simple experiment: Dip a wand in pure water instead of in your soap bubble liquid and try to make a bubble. You will not succeed in making bubbles, contrary to when using a mixture of water and soap. This experiment illustrates two things
To understand how soap can stabilize a film of water we must first understand why a film of pure water is unstable. The main reason is gravity. This is nicely illustrated by this movie showing a film of pure water made inside a space station (in zero gravity).
To explain the influence of gravity on liquid films, imagine a vertical film of water as illustrated below. Gravity pulls the water downwards making it thicker in the bottom and thinner at the top. Such a thickness gradient will develop on a time-scale of seconds.
In addition to the pull of gravity, the water molecules attract each other due to their polarity. Water molecules in the bulk (that is the molecules that is not near the water surface) will be attracted on average equally from all sides and the net mean force on them will therefore be zero. But when a film of pure water is sufficiently thin the molecules at the surfaces will start to “feel” the attractive force from the each other. The water molecules at the surface are attracted by water molecules in the bulk while no molecules attracts them in the other direction (actually, there will be a very weak attraction from the molecules in the air, but this is negligible). Therefore, a net attractive force between two water surfaces will appear once the distance between them is sufficiently small. At this stage both gravity plus surface attraction is thinning the water film and the thinning is accelerated until the film collapses.
The attraction between the water molecules is, by the way, also resulting in the phenomena surface tension. Surface tension is the force that hold a soap film together and minimizes its surface area (read more about surface tension here). This means that the attractive forces between the water molecule results in two different phenomena: a) surface tension which acts along the surface of the film, and which does not depend on the film thickness. b) The attraction between the two surfaces described above, which only appears for very thin films and which acts across the film.
Soap molecules are quite special by having a non-polar tail that does not mix well with water. To minimize the mixture with water the soap is therefore mainly located at the surfaces of the liquid (This is true as a first approximation, but the structure of a soap film may be much more complicated). One part of the soap molecule is however attracted to water. This is a negatively charged part of the molecule, which makes mixture of water and soap possible (unlike water and oil). See more about soap molecules here.
A liquid film made from water plus soap is also thinned by gravity in the top region, but the surfaces in thin regions will repel each other due the negative charges of the soap molecules (illustrated below). A soap film is therefore thinned down to the thickness where the surfaces start to “feel” the repulsive force between them. If the repulsive force is strong enough to overcome both the attractive forces from the surface water molecules and the pull from gravity, the soap film will be stable.
Ignoring gravity, the forces acting across a soap film are described mathematically by the so-called DLVO theory (named after Derjaguin and Landau, Verwey and Overbeek). The figure below shows graphs according to the DLVO theory of the so-called potentials for a liquid thin film.
The black line represents the potential describing the attractive and repulsive forces acting across the soap film. You can thick of such a graph of potentials as if the attractive forces are pulling the line down and the repulsive forces are pulling the line up. This means that one has to apply force to move upward in the plot, while movements downward can happens spontaneously. Similar to when walking in a landscape with hills and valleys where you have to use force to go up on a hills, while you can, at least in principle, roll or fall down into a valley without using force.
Imagine a soap film that is at first thick, maybe a micron or so, but over time is thinned by gravity. The graph shows what will happen when the soap film becomes really thin: When the thickness reaches ca. 50 nm the potential becomes positive. This means that repulsive forces start to dominate. If the repulsive forces are stronger than the pull from gravity, the thinning of the soap film will stop. The soap film is at this point a so-called Common black film. It is too thin to show interference colors and therefore appear black on a black background. The soap film is, however, not fully stable and further thinning may happen, for example by evaporation of water. When the soap film gets thinner the potential reaches a maximum (on the graph this is at a thickness of ca. 10 nm). After this it drops rapidly, it reaches a minimum (at ca. 5 nm) and increases very rapidly (at ca. 4 nm). This means that the attractive force dominates for some thicknesses below the common black film until reaching a new stable thickness. This is the so-called Newton black film. Notice, that the mentioned numbers are realistic for a soap film, but variations are reported for the thicknesses of a common black film (5-200 nm) and a Newton black film (3-5 nm).
While the black line represent the sum of positive and negative forces, the green line represents the potential from the attractive forces between the water molecules. The red line represents the potential from the repulsive forces from the negatively charged soap molecules, the so-called double layer repulsion. The blue line represents some additional forces that appear when the soap film thickness is in the order of magnitude of the size of the molecules. At that point it becomes difficult to thin the soap film further and the dominating forces in the soap film are repulsive.
Two things might be worth mentioning at the end: Firstly, although the potential increases towards infinity in the graph, this does not mean that a Newton black film is fully stable. It just means that additional forces will rather break it than thinning it further. Secondly, the soap bubble liquid we typically use for making soap bubbles contains a relatively large amount of soap molecule beside glycerin and other additional molecules. The structure of soap films from such mixtures will be more complicated, for example with extra soap micelles and bilayers. These additional structural features likely influence the thickness dependent potentials so that there are more hills and valleys in the graph, which means that there are more metastable thicknesses of the soap film.
You can read more in scientific papers, for example:
or in books, for example: