Origin of Elasticity

A toy model of a solid

A very simple model of a solid is to imagine a bunch of molecules linked to their nearby neighbors by springs (you don't need to imagine a crystalline lattice, it can be amorphous).

The springs are the effective electromagnetic interactions between the molecules; they are strongly repulsive at close range and attractive at modest ranges which implies a zone of equilibrium. And for small displacements they really are roughly linear which means that the spring model makes sense.

The model is not perfect of course, at overly large distances the interaction drops strongly and the springs effectively break; and relative motions can cause new "nearby" neighbors from behind old ones rearranging the tangle of springs entirely.

Given time the solid will settle into a global equilibrium disturbed by the thermal motion of all molecule; we assume a temperature low enough that each one jitters around in it's own little space trapped by the forces from it's neighbors.

Elasticity

Now, if you push slowly on opposite sides of this thing, each surface molecule will move a little towards their inner neighbors who will move a little out of the way and the force will becomes distributed throughout the bulk with the distance between molecules reduced slightly in the direction of the compression. Pulling the two ends apart spreads the molecules slightly.

In either case, if you relax the external forces the body returns to it's original configuration.

Ta Da! Elastic behavior!

How about in-elasticity?

If molecules get pushed too hard they might pop over a local maximum and settle into a new, different equilibrium configuration. These kinds of large displacements can result in the breaking of some springs and the establishment of new ones.

If we release the pressure on this configuration it will return to a different free configuration than our starting point: non-elastic behavior.

This model has too much hand waving in it to produce a clear taxonomy of non-elastic behaviors.

Fluids

Because the molecules of liquids and gases do not maintain their relative positions this model is completely inappropriate and not applicable to these phase of matter.