Fact 1: completing a circuit causes electricity to flow through that circuit. 
Fact 2: When the animal makes contact with the fence the circuit is complete.
An animal contacting an electric fence allows the electricity to flow.