Soap, Oil, and Water: Why Some Materials Mix and Others Separate