Allah azzawajal is Al-Hakeem (the perfectly wise). Owner of the infinite wisdom. we humans with our finite minds can only try to ponder and contemplate on the signs which He has shown us. Allah azzawajal says in the glorious quran ;
Verily, Allah is Ever All-Knowing, All-Wise. [76:30] (translated mohsin khan)
keeping this in mind i will try ...