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 is 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 (Matthew 25:41).
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 choice. God created free beings, the angels and human beings. If God wanted beings who simply did what they were programmed to do, the animals would have sufficed. No, God desired beings with whom He could have a genuine relationship, and therefore He gave us all the ability to choose, and presented us with a choice.