My journal says that my Ponyta ran away
So, I was wondering when and why does a Pokemon run away?
Your own captured Pokémon will not run away. The only way to lose it is transferring it by accident. Your journal is showing an instance of a wild Ponyta fleeing from battle, which can happen randomly if you fail to capture it too many times, probably more commonly with stronger Pokémon.
A good way to ensure a capture is using better Pokéballs and Razz Berries, but keep in mind that capture attempts can still fail and Pokémon can still flee even when using those items.
The more CP a Pokémon has the harder it gets to catch it. That Ponyta had 400 CP, which is pretty hard to catch with a simple Pokéball. You'll have to use better Pokéballs and Berries in order to have a good chance of catching a high CP Pokémon.
(There is still no guarantee to actually catch one when using Berries and good Pokéballs, but it will increase the chance significantly.)
Once a Pokemon is captured, it will never run. You can send it away to the professor, but it won't run on it's own.
While in battle, however, they can flee. Some Pokemon have a higher chance to flee naturally compared to others. The higher CP they have, the higher their chance as well. The higher your level is, the higher their chance seems to also be. This could mean you are trying to get a 50cp pidgey and it may flee if you are level 20+ anyhow. Last but not least, as others have said, if you are moving too fast.. it seems to increase the flee rate as well. This may simply be once you are out of the range of where they spawned while you still battle them that the flee may happen (or is increased in likelyhood).