Why did God send an evil spirit to torment king Saul?
This is a tough question. It can be hard to square our understanding of God as a loving father with biblical statements that God allows people to be overcome by evil. I would explain this by pointing out that there are a number of places in the Bible in which it is clear that when we choose deliberately to rebel against God and dive deeply into sinful behavior, God will give us over to that sin. In other words, it is as if he says to us, If that is what you want, then you can have it until it is coming out your ears! There is the example in Numbers in which people are demanding God to send them meat. What he did is he sent them so many quail that they are completely sick of them. This is in Numbers Ch. 11. In Romans 1:24, 26 and 28 God tells us that he will “give us over” to the sins we choose over him. If we embrace abominable behavior, God will allow us to become immersed in it in the hopes we will come to our senses. In 2 Thessalonians 2:11-12 we are told by Paul that God will send a powerful delusion to those who choose not to believe the truth. There are many examples in the Prophets in which God describes people throwing the things they had so greatly valued into the streets because they are now disgusted by them.
I do not want to simply dismiss the difficult emotional response you and I have to the idea that God would send an evil spirit to torment Saul. Even if I can give you a logical reason God would do this, it is still hard for us as humans to accept this. But, the reason God does this is so that we might understand our terrible situation and, just possibly, repent of our actions. God was hoping that if Saul would not worship him because God loved him, perhaps if he became sufficiently desperate, Saul might have repented and turned to Him. Unfortunately, this did not happen. When God gives us over to the sin we have embraced, it will either judge us or it will cause us to repent and be saved. Either way, God’s qualities of holiness, judgment and love are preserved.
Like I said, this is a hard question, but I believe that this is the correct answer to your question.