Answer: To a degree, why God allows the devil to operate is part of the general question of the problem of evil. That is, why does an all-good, all-powerful, all-knowing God allow evil to exist? A description of the devil and his revolt against God appears in Isaiah 14 and Ezekiel 28. Although it can be disputed about where the description of the kings of Babylon and Tyre begin and end, these verses most sensibly can be applied to him.
You (the devil) were the seal of perfection, full of wisdom and perfect in beauty. You were in Eden, the garden of God . . . You were the anointed cherub who covers; I established you; You were on the holy mountain . . . (Ezekiel 28:12 - 14).
Ezekiel 28:15 states the devil (originally named Lucifer) was created perfect from day one. He, however, indulged himself to think selfishly to the point of rebellion! He, at one time, was one of only two cherubs who covered the throne of the universe (Ezekiel 28:14). The question becomes why does our Maker put up with the devil and his continuing evil influences and whining (Ephesians 2:2, 2Corinthians 4:4, Revelation 12:10)?
A teaching tool
By allowing evil to exist, our Father is not merely trying to prove something to mankind, but also to all beings. Since people (or even angels) will not necessarily take God's word that other ways of living are far inferior to his, He has allowed humans to live and experience all these other options. In the end, humans will know from experience that only God's way of thinking produces the kind of existence worth possessing for all eternity.
For example, one major deception of the devil is that its not a big deal if people have sex before or outside of marriage. The Eternal allows humans to indulge in this behavior and suffer the consequences from it such as unwanted pregnancies, diseases, abortions and so on. If people were denied the freedom of choose such ways, which are self-defeating, then they could complain they have been denied the ability to prove whether his ways are truly the only path to a perfect existence.
God allows the devil to live, for the time being, in order to help us develop holy righteous character and to do so quicker. An apt analogy would be someone who lifts weights and exercises. Physical strength and endurance can be achieved much faster by resisting the pull of gravity more forcefully through such activities. In the spiritual realm, Christians are able to develop holy righteous character that will last forever by constantly choosing to resist the pulls of their human nature and the temptations of the devil.
Good from evil
It should be noted that not only could the devil been permanently taken out of existence when he sinned but also Adam and Eve. God, however, decided in advance that when (not IF) humans choose to sin that He would redeem them. He did this by allowing Jesus to give up his divinity and to suffer like humans from the consequences of sin. Christ chose to be tempted by the devil, and die a horribly painful death for those, even today, who do not yet understand the plan of salvation.
God is in the process of making beings like Himself who have perfect free will, like He does, and who use it to always choose to be holy and righteous in all that they think and do (Matthew 5:48). He has, in his wisdom and love, chosen to use the devil to accomplish this lofty goal in the shortest time possible. When his plan and purpose are finally completed he will (likely) eternally end our adversary's life in the lake of fire.