Question: "Why did God allow Satan and the demons to sin?"
Answer: With both the angels and humanity, God chose to present a choice. While the Bible does not give many details regarding the rebellion of Satan and the fallen angels, it seems that Satan—probably the greatest of all the angels (Ezekiel 28:12-18)—in pride chose to rebel against God in order to seek to become his own god. Satan (Lucifer) did not want to worship or obey God; he wanted to be God (Isaiah 14:12-14). Revelation 12:4 is understood to be a figurative description of one third of the angels choosing to follow Satan in his rebellion, becoming the fallen angels—demons.
Unlike humanity, however, the choice the angels had to follow Satan or remain faithful to God was an eternal choice. The Bible presents no opportunity for the fallen angels to repent and be forgiven. Nor does the Bible indicate that it is possible for more of the angels to sin. The angels who remain faithful to God are described as the “elect angels” (1 Timothy 5:21). Satan and the fallen angels knew God in all His glory. For them to rebel, despite what they knew about God, was the utmost of evil. As a result, God does not give Satan and the other fallen angels the opportunity to repent. Further, the Bible gives us no reason to believe they would repent even if God gave them the chance (1 Peter 5:8). God gave Satan and the angels the same choice He gave Adam and Eve, to obey Him or not. The angels had a free-will choice to make; God did not force or encourage any of the angels to sin. Satan and the fallen angels sinned of their own free will and therefore are worthy of God's eternal wrath in the lake of fire.
Why did God give the angels this choice, when He knew what the results would be? God knew that one-third of the angels would rebel and therefore be cursed to the eternal fire. God also knew that Satan would further his rebellion by tempting humanity into sin. So, why did God allow it? The Bible does not explicitly give the answer to this question. The same can be asked of almost any evil action. Why does God allow it? Ultimately, it comes back to God’s sovereignty over His creation. The Psalmist tells us, “As for God, His way is perfect” (Psalm 18:30). If God’s ways are “perfect,” then we can trust that whatever He does—and whatever He allows—is also perfect. So the perfect plan from our perfect God was to allow sin. Our minds are not God’s mind, nor are our ways His ways, as He reminds us in Isaiah 55:8-9.