After being hit while attached to you by the lead, the animal tries to run away. Once it gets to the furthest the lead lets it, it comes back to the player. But then it starts to run away again. This repeats indefinitely.
When the animal is released from the lead, it still runs away, but it never stops fleeing the player that hit it (this constant running around is hilarious).
I'm guessing it's happening because the distance the animal wants to flee to is larger than the distance the lead lets it go, so it keeps trying to get away, and is stuck in fleeing mode when released.
This also happens if the animal is attached to a fence post by a lead, but only if the player is standing near the fence post it's tied to when hitting it. It stops running if you move far away enough from the animal.
Steps to reproduce:
1. Play in Creative mode.
2. Create an enclosure (solely because you'll never be able to kill the animal if you let it loose, not even with a bow).
3. Spawn an animal (ex: cow, pig, chicken, sheep).
4. Attach the animal to a lead.
5. Hit the animal.