Consider a clause in Latin that has n words. Latin frequently uses scrambling, so there are n! possible ways to arrange that clause given a free word order. However, Latin writers use only a small subset of those n! clauses. What criterion did they use to determine that subset?
There's not one criterion, but many, which are usually to do with discourse pragmatics and information structure: phenomena like topicalization, focalization, existential and presentative constructions, etc., can cause departures from Latin's usual SOV order. This recent book gives a lot of details.