Gustaf Aulen (1879-1977)was a Swedish Theologian who, more so than most, gave attention to the concept of atonement. His book CHRISTUS VICTOR is considered one of the "go to" books on the subject. Although his work would connect with the more recent "Victory Theory," he stated that the ransom theory was really the first to find expression and that it should be considered the CLASSIC theory. In time, he would build on the ancient idea, change it a bit, and develop his own thought.
Two ancient church fathers (Irenaeus, late 2nd century) and Origen (3rd century) laid the groundwork for this concept in their writings and debates. They would build on a text such as Mark 10:45 where Jesus said, "For the Son of Man came not to be served, but to serve, and to give his life a ransom for many."
The theory is as follows: because of sin, humanity winds up on the devil's turf. Satan laid claim to all humanity and enslaved (Irenaeus) them in a reality of sin, evil, and death. No hope, no escape from any human vantage point.
But God chose to act. God offered the necessary payment (Jesus) to the devil as a ransom to free all humanity. Rather than a holy God destroying a sinful humanity, God was willing to "buy back." Martin Luther would later describe the process thusly: "The blood of Jesus became the bait on the fishhook that caught the devil."
However, the death of Jesus on the cross became only a part of the deal. The devil thought himself satisfied because he had received the perfect ransom. But God tricked the devil by continuing the story. Jesus was resurrected, which made him victorious over all sin, evil, and death. The devil was defeated and humanity was freed.
Some concluding thoughts: This theory, in my opinion, makes God deceitful. God promised payment with God's son, and then took it back through the resurrection of that same son. Just because God was dealing with the devil does not keep God from being like Jacob, a "trickster."
Secondly, even though the paid ransom freed humanity, most religious groups still say that humanity needs to jump through certain hoops before God's grace will be applied and God will accept the human, i.e. confess one's faith, join a church, etc.