Materials that conduct electricity also oppose its flow to some degree. This phenomenon is known as resistance, and every electrical conductor, no matter how efficient, displays it to some degree. Copper wire is a good conductor with low resistivity, but resistance increases with decreasing wire size, and one of the byproducts of resistance is heat. Remembering these facts can help you understand why your wall outlets are overheating and what to do about it.
The electrical code is specific about the thickness of wire, also known as the wire gauge, that you should use, based on the expected maximum current flow through it. For residential 120-volt circuits, 14-gauge wire is allowed for 15-amp or smaller circuits, but circuits with a larger current flow should use 12-gauge wire, which is thicker. Even thicker wires are required for 240-volt circuits that draw more than 20 amps. One of the main reasons for the wire size requirements is to prevent overheating of the wires and the resulting damage to equipment and possibility of fire.
Electricians are required to install outlets with the proper gauge wire, but homeowners often modify their circuitry without consulting the codes and make mistakes in the process. One such mistake to extend the circuit from an existing outlet with a smaller gauge cable than the incoming one. The smaller wire creates a bottleneck for electricity as it passes through the outlet on its way along the circuit, and the extra resistance heats up the outlet terminals and the outlet. In such a case, you may notice the outlet getting hot even if you aren't using it.
An outlet can heat up for a related reason when you use it to power an appliance that draws more power than the outlet is designed to supply. For example, you may be using an outlet to supply an appliance or power tool and find that it occasionally draws more than the circuit can handle and trips the circuit breaker. If you attempt to remedy the situation by simply replacing the breaker, the outlet will get hot every time the appliance or tool draws more electricity than the outlet and the wires attached to them can handle.
Loose connections are responsible for many melted outlets and fires. If one of the terminal wires works itself loose from the terminal screw, electricity may arc between the wire and the terminal. Air has a higher resistivity than copper, and more heat is produced when electricity passes through it, which is one reason why lightning strikes often result in fires. A poorly fitting plug or a loose outlet can also cause arcing. Heat from loose connections is seldom benign enough to simply warm the outlet. It usually results in damage to the outlet or plug.