Hume identifies three associating principles. Resemblance: seeing a portrait naturally leads us to think of the person depicted. Contiguity in time or place: thinking of one room in a house leads us to consider the adjoining rooms. Cause and effect: thinking of a wound leads us to think of the pain that followed. These three principles are not logical necessities — they are psychological forces, the gravity of the mental world.
Hume makes a large claim: all complex ideas — and therefore all complex thinking, all poetry, all argument, all science — are produced by these three associating principles operating on simple ideas derived from impressions. The human mind does not create ex nihilo; it combines and rearranges what experience provides, guided by resemblance, contiguity, and causation.
The association of ideas is Hume's attempt to do for psychology what Newton did for physics: identify the fundamental forces from which complex phenomena are derived. Just as gravity explains the motions of celestial bodies, association explains the motions of thought. Whether or not the reduction succeeds, the ambition inaugurates something new — an empirical science of the human mind rather than a merely introspective one.
Association of ideas was a common concept before Hume — Locke had used it — but Hume systematises it and makes it the foundation of his entire theory of mind. His three principles of association were later expanded by later associationists including James Mill and his son John Stuart Mill.