Question: "How and to whom did Jesus pay our ransom?"
A ransom is something that is paid to provide for the release of someone who is held captive. Jesus paid our ransom to free us from sin, death, and hell. Throughout the books of Exodus, Leviticus, Numbers, and Deuteronomy are found God's requirements for sacrifices. In Old Testament times, God commanded the Israelites to make animal sacrifices for substitutionary atonement; that is, an animal's death took the place of a person's death, death being the penalty for sin (Romans 6:23). Exodus 29:36a states, "Each day you must sacrifice a young bull as an offering for the atonement of sin."
God demands holiness (1 Peter 1:15-16). God's Law demands holiness. We cannot give God full holiness because of the sins we commit (Romans 3:23); therefore, God demands satisfaction of His Law. Sacrifices to Him satisfied the requirements. This is where Jesus comes in. Hebrews 9:12-15 tells us "Once for all time he took blood into that Most Holy Place, but not the blood of goats and calves. He took his own blood, and with it he secured our salvation forever. Under the old system, the blood of goats and bulls and the ashes of a young cow could cleanse people's bodies from ritual defilement. Just think how much more the blood of Christ will purify our hearts from deeds that lead to death so that we can worship the living God. For by the power of the eternal Spirit, Christ offered himself to God as a perfect sacrifice for our sins. That is why he is the one who mediates the new covenant between God and people, so that all who are invited can receive the eternal inheritance God has promised them. For Christ died to set them free from the penalty of the sins they had committed under that first covenant."
Also, read Romans 8:3-4, "The law of Moses could not save us, because of our sinful nature. But God put into effect a different plan to save us. He sent his own Son in a human body like ours, except that ours are sinful. God destroyed sin's control over us by giving his Son as a sacrifice for our sins. He did this so that the requirement of the law would be fully accomplished for us who no longer follow our sinful nature but instead follow the Spirit."
Clearly, Jesus paid the ransom for our lives to God. That ransom was His own life, the shedding of His own blood, a sacrifice. Due to His sacrificial death, each person on earth has the opportunity to accept that gift of atonement and be forgiven by God. For without His death, God's Law would still need to be satisfied—by our own death.