I used to flee a lot. Whenever I felt like I was losing, tbh. But I've stopped that and found I win a lot more battles now.
Now I flee when it's a lost cause. I mean, like when I'm down to one pet with only a tiny bit of HP and the other side has two pets up. Things like that.