In set theory and logic this rule is called the Identity of Indiscernibles (if two sets "have the same properties"—that is, they are contained within the same sets—then they are equal).
But in real life there are complications, such as those mentioned in the Wikipedia page you referenced...
Consider the collection: $A=\{x \mid \text{ Lois Lane believes }x\text{ can fly}\}$ Clearly, $\text{Superman}\in A$ but $\text{Clark Kent}\not\in A$. Thus by the Identity of Indiscernibles, $\text{Superman}\not=\text{Clark Kent}$, which we know to be false. The contradiction arises under the assumption that $A$ is a set. It may just be a proper class. And I don't believe proper classes follow the same rules as sets.
Anyway, under First-Order Logic with equality, the Axiom of Extensionality states that equal sets contain the same exact elements: $(x=y) \iff \forall a(a\in x \iff a\in y)$ However, in FOL without equality, rather than taking this fact as an axiom, we can make it a definition. Under this definition of equality, we would make the Axiom of Extensionality state that equal sets, "equal" as defined above, have the same containers: $(x=y) \iff \forall b(x\in b \iff y\in b)$ This expands to: $\forall a(a\in x \iff a\in y) \iff \forall b(x\in b \iff y\in b)$
The bi-directionality of the statement proves the Identity of Indiscernibles.