Weber's Theory
In the mid-1800's a scientist named Wilhelm Weber came up with a magnetic theory which is still popular today. In his view, the spinning electrons in an atom create an electromagnetic field, making all molecules like miniature magnets, which align with the sum total of all magnetic moments in each atom. In non-magnetized substances, the molecules are not aligned, but in magnetic ones, the molecules form into structures that align themselves along a single magnetic axis. This shared magnetic axis is what provides its ability to attach itself to other magnetic surfaces.
Domain Theory
While Domain Theory was developed in 1906, it's still considered a valid explanation of how magnets work (though it has been updated to include modern understanding of atomic theory). In this theory, an atom alone is merely one part of a community of electromagnetic particles. When exposed to a nearby magnetic field, these groups organize themselves into magnetically-aligned domains. Each domain attempts to balance two opposing forces to minimize the overall energy of the system--the internal cohesion of the domain and the forces between the various domains. The ability of domains to form in other nearby ferromagnetic surfaces creates a mechanism for attraction that allows the magnet to stick.
Quantum Theory
Quantum Theory describes magnetism by looking at the interaction of the electrons in the outer shells of atoms. Pauli's Exclusion Principle requires that electrons with a spin value must pair up with one of the opposite spin to create stability. If electrons are balanced (that is, containing equal numbers of opposing spins) then the material is not magnetic. If the outer level of the electron shell contains an unpaired electron, it will create a net magnetic field. At short distances, the desire of an electron to find a partner of opposite spin creates an attractive force that exceeds the repulsive electric force.
Conclusion
While Quantum Theory (paired with other theories of magnetism), creates an adequate explanation of what is taking place to produce the attractive force that allows a magnet to stick to a surface, there is no universally accepted view of how magnets work. And since the mechanisms scientists use to depict these forces are still as of yet unproven, there is no way to absolutely state that any of the current views will not change as science uncovers more about the way atoms work. In the end, you are given the choice of trusting an educated guess or waiting for a better answer.