The height of a set S is an ordinal that measures the distance from S down to the ground. For instance, the height of the empty set is 0, the height of (∅) is 1, the height of ((∅)) is 2, and so on. A set with a well defined height is "well founded".
If all the members of S have a well defined height, let the height of S be the union of the successors of the heights of the members of S. This gives a union of ordinals, which is another ordinal. Show by transfinite induction that the height of an ordinal is itself.
Note that the height of S exceeds the height of any member of S. Containment is a ratchet that increases height. If a set S contains itself it obviously can't have a well defined height. In general, a set S that leads back to itself after a finite chain of containment is not well founded. It would have a height h that is less than h.
There is 1 set of height 0, namely the empty set. There is 1 set of height 1, (∅). Thus there is 1 set of height 1, and 1 set of height less than 1. Next, there are 2 sets of height 2, ((∅)) and ((∅),∅), and of course 2 sets of height less than 2. In general, if there are c sets of height n, and d sets of height less than n, then the number of sets at height n+1 is (2c-1)×2d, and the number of sets whose height is less than n+1 is c+d. This establishes a system of two partial difference equations. I don't have solutions to these recurrence relations in hand, but I do know the number of sets of height n or less is always finite.
If an infinite set has height n then there are infinitely many members of that set with height n-1 or less, which is impossible. Therefore an infinite set has infinite height. Ann example is ω, which has infinite height, even though each member has finite height.
Every set implied by the prior axioms is well founded. The empty set has height 0; build sets from there. Pairing, union, replacement, and power set create new sets whose members are preexisting sets. By induction on the length of an inference, every set has a well defined height.
As an added bonus, every chain of containment is finite. If S is forced to exist by our axioms then its members were created earlier, via a shorter chain of inference. Select one of these members and repeat the process. No matter how huge the set, we can descend to the empty set in finitely many steps. When you select a member of ω, 17 for example, you have stepped past infinitely many sets. You can go up forever, as the chain of inference gets longer and longer, but a descending chain of membership is always finite, ending with the empty set. Again, this only holds for the sets implied by the previous axioms. If some other set S exists, and contains itself, it has no height, and you cans step through S contains S contains S forever.
The foundation axiom declares all sets are well founded. That rules out the set that references itself, directly, or through a chain of containment. It also rules out an infinite sequence of descending sets. As you step through the sequence you step down through the ordinals, the heights of the sets. Use transfinite induction to show each ordinal has a finite chain of containment down to the empty set.
With the foundation axiom in place, all sets are anchored to the empty set, with a well defined height.
The last axiom in standard set theory is the axiom of choice. This was described earlier.