Question: "Why was a contract with the gods made?"  Context: "Extraordinary circumstances called for extraordinary sacrifice: in one of the many crises of the Second Punic War, Jupiter Capitolinus was promised every animal born that spring (see ver sacrum), to be rendered after five more years of protection from Hannibal and his allies. The "contract" with Jupiter is exceptionally detailed. All due care would be taken of the animals. If any died or were stolen before the scheduled sacrifice, they would count as already sacrificed, since they had already been consecrated. Normally, if the gods failed to keep their side of the bargain, the offered sacrifice would be withheld. In the imperial period, sacrifice was withheld following Trajan's death because the gods had not kept the Emperor safe for the stipulated period. In Pompeii, the Genius of the living emperor was offered a bull: presumably a standard practise in Imperial cult, though minor offerings (incense and wine) were also made."  Answer:
The answer to this question is:
protection