This question has bothered people for centuries, but it is really quite simple to answer. In the beginning, God gave man authority over the earth (Genesis 1:28). When man rejected the commandment of God and submitted to the voice of the devil, he in effect transfered his authority to Satan. This is why Jesus now refers to Satan as 'the ruler of this world' (John 14:30). This is also why John writes that 'the whole world lies under the sway of the wicked one' (1 John 5:19). The reason there is evil in the world is because the world is primarily under the influence of Satan, not God. But that will change in the very near future when Jesus returns and the devil is 'cast into the lake of fire and brimstone' (Revelation 20:10). Then 'God will wipe away every tear from their eyes; there shall be no more death, nor sorrow, nor crying. There shall be no more pain, for the former things have passed away' (Revelation 21:4).