God answered a question with a question, several actually.  Job wanted to know what was going on, so God asked him a ton of questions to show our man just how complicated everything is.  The Lord wasn’t trying to belittle His servant, but was trying to show him that, even if everything was explained to him, the answer would be too complex to truly grasp.  However, not only does God explain to us the scene behind what was happening, later Scripture even gives us a bit more info.  It may not be the full answer, but what was most likely the reason for the whole ordeal?

-God wanted to brag on Himself-

-God wanted to trick the devil-

-Job had good moments, so now it was time for the bad-

-God wanted to teach Satan and the angels a lesson, too-