It's an evolutionary trick to distract the pursuer, much as lizards lose their tails.