Electric fish generate electricity through special cells called electrolytes, stacked together like batteries in their bodies. When these electrolytes are activated, they produce an electrical current that can be used for communication, navigation, and defense. The strength and frequency of the electrical pulses can vary depending on the electric fish species and their situation.