I'm suprised no one mentioned about Iblis (satan). If you understand the story of the Iblis and the jinns,and understand how life started, it will help answer your question. Iblis like the rest of the jinns has free will. Iblis was one of the better and worthy jinns who was brought up to the heavens. Angels don't have free will, they are obedient to God.
Iblis did not bow down to Adam (pbuh) when Allah (God) told him. Iblis said I am better than him, I am made of fire and he's made of clay. Iblis asked Allah to let him live until the end of time (for Jinns can live and die, have children, just like us humans, and the powers to possess things, and since they are also invisible to us, but we are not invisible to them) and he would make humans sin and not believe in the true Creator (Allah).
So If you understand the purpose of life, the story of the jinns and humans having free will. It will answer all your questions of evil and more.
salaamalik