All electric fences are based on three fundamental components.
The energiser: This takes a power supply and generates the pulse of current
The fence wire: This conducts the current pulse
The earth connection: This gives the current pulse a path to complete the circuit
An electric fence works by sending short, high voltage pulses of electrical current along the fence from the energiser. When an animal touches the fence it closes the circuit and sends the current back to the energiser through the earthing system. This pulse will pass through the animal very quickly, so the animal will only feel a brief shock.
The animals will dislike the sensation, deterring them from going near the fence. Most animals will receive a shock within the first week of the fence being erected, and from then on the animal will avoid the fence. which makes electrical fencing the safest and most reliable solution when it comes to securing and keeping your animals or livestock safe.
It is this same unpleasant sensation which deters predators and other pests and keeps them OUTSIDE of the fenced area.