When a UFO decides to run away is based on its escape timer, and it rolls a value anywhere from the internal escape timer to some additional amount below it. On higher difficulties, there is an additional reduction to the escape timer depending on the difficulty. This means that the lower a UFO's escape timer, the more random its time to flee will be, and the more it will vary by difficulty.
In vanilla, small and very small UFOs will flee fairly quickly, but anything larger typically stays for the whole fight.
You can use the hyper wave decoder to make a better estimate about whether a UFO will land or not. This works in both vanilla and mods; you simply have to watch what a ship does in a given mission and try to find a pattern. It is rarely guaranteed, however, but some missions land a lot while others pretty much never land.
A UFO's specific mission, region, and wave number determine its exact flight pattern (randomized by choosing a random waypoint from a specified list), however mods are able to make multiple different missions with the same name.