There are many issues that can cause an electrical outlet to work either sporadically or not at all. There are many symptoms that you can analyze to determine your specific problem, and you should try to do so, even if you intend too replace the troublesome component.
Symptoms and solutions for electrical outlet issues
If your outlet is improperly grounded, it may emit a spark and a crackling sound when a plug is inserted or withdrawn.
Older homes sometimes lack a ground wire in their wiring, relying on only a hot wire and a neutral wire. The soft sheathing that served as insulation on old style wiring also served as a grounding agent.
As the old sheathing decomposes over time, improper grounding may result.
The solution to the problem would be to add a ground wire to the outlet and secure it to both the grounding terminal of the outlet and either the metal gang box in which the outlet sits or the metal screw of the face plate that covers and protects the outlet.
The outlet or plugs get hot when in use
This is a sign of an overloaded line. You are attempting to use more power than the individual circuit can handle. It is actually beneficial that the outlet or plugs get hot, because the wiring inside the walls and ceilings are also overheating, presenting a serious risk of fire.
You have only two options. You must either limit the number of components that you plug into the outlet (no power strips, and especially no power strips running from other power strips), or upgrade the circuit.
Upgrading the individual circuit involves replacing the wiring from the breaker box to the outlet with a heavier gauge wire, which can be a monumental task because of limited access to the wiring. You must also replace the circuit breaker.
These are tasks best suited to a residential electrician for a home upgrade or a commercial electrician for a business upgrade (for compliance with municipal electrical codes).
This is obviously an issue that can't be ignored because of the risk of fire. Burning occurs when improper contact is made by the wires connected to the outlet.
This can occur when one of the wires comes lose from a terminal and strays to make contact with another terminal. The circuit is then completed in an uncontrolled manner resulting in extreme heat
Rodents or other pests can also cause a problem, because they can fit into the narrow gap between the outlet and the inner wall of the gang box in which the outlet rests. Squeezing into this tight space presses them against both the hot and neutral terminals on the side of the outlet, creating a full circuit and a fried rodent.
Rodents can also chew the wires connected to the outlet, causing a short circuit.
Before you replace an outlet, you must correct these problems that caused the issues or they will occur again when the new outlet is installed.