Its tail discharges electricity into the ground, protecting it from getting shocked.
If it stores too much electricity, its behavior turns aggressive. To avoid this, it occasionally discharges excess energy and calms itself down.