Even though it does not reflect quantum mechanics, the classical formula for electrostatic potential energy is a useful mental tool for interpreting internal energy change in chemistry as long as you keep its limitations in mind.
Several modules ago we were discussing the electrical force in the context of the internal energy of real substances. We developed our sense of the changes in electrostatic potential energy at the atomic, molecular or intermolecular level as charged particles shift positions in the course of chemical events such as ionization at the atomic level, covalent bond formation at the molecular level, or vaporization at the intermolecular level. We developed our understanding of thermochemistry to account for the conservation of energy setting the parameters for the relationship between internal energy change, heat flow, and work. Now we are working to develop an understanding of chemical thermodynamics to understand what drives spontaneous change. Let us set the stage to cross the bridge from thermochemistry to chemical thermodynamics.
To help us cross the bridge, let us first review the path which has led us here from our understanding of the electric force. Imagine the the thermodynamic system plus its surroundings. Energy moves between the system and its surroundings by either heat flow (quantity of energy transferred across the boundaries of the system by conduction or radiation) or thermodynamic work (a directed force acting through a distance or pressure acting through a change in volume). From the 1st law of thermodynamics, we know that whether a change is simple or complex, the sum of the heat transferred to the system and the work done on the system equals the change in internal energy. The first law is just a way to expressing conservation of energy where change in the system must equal the sum of heat flow and work.
What does it mean, though, for a chemical system for the internal energy to change? For a chemical system, there are two primary kinds of internal energy for most common situations, the kinetic energy of the particles and the electrostatic potential energy associated with charge interactions at the particle level. Most chemical processes involve changing the relationship of charged particles with regard to each other. Ask yourself: In the new arrangement, are opposite charges closer together? Are like charges farther apart? In either of these two cases, internal energy will have decreased.
The internal energy change is determined exactly by the initial and final state of the system independently of the path through which the change has been effected. If the internal energy of the system has decreased, where did the energy go? The first law of thermodynamics, and by extension to thermochemistry, tells us that some combination of heat flow and work must have occurred. Before discussing spontaneity and equilibrium, it is crucial to understand where the heat flow is coming from.