Dear Brothers and Sisters in Islam
1- Allah knows everything before they even happen because his knowledge in full, he created us and he knows what he created so he knows what we are and what we will chose and when and why.
65:12
{ ٱللَّهُ ٱلَّذِي خَلَقَ سَبْعَ سَمَٰوَٰتٍ وَمِنَ ٱلأَرْضِ مِثْلَهُنَّ يَتَنَزَّلُ ٱلأَمْرُ بَيْنَهُنَّ لِّتَعْلَمُوۤاْ أَنَّ ٱللَّهَ عَلَىٰ كُلِّ شَيْءٍ قَدِيرٌ وَأَنَّ ٱللَّهَ قَدْ أَحَاطَ بِكُلِّ شَيْءٍ عِلْماً }
(Allah it is Who hath created seven heavens) one above the other like a dome, (and of the earth the like thereof) seven earths but they are flat. (The commandment cometh down among them slowly) He says: He sends the angels down from heaven with revelation, Scripture and calamities, (that ye may know) and acknowledge (that Allah is Able to do all things) relating to the dwellers of the heavens and the earths, (and that Allah surroundeth all things in knowledge) and that His knowledge encompasses everything'.
2- ِAllah gave the human the abilities to choose and the will but his will is under the will of Allah because nothing happens except when Allah wills too.
example: a person may want to shoot someone and kill him, he might pick the gun and shoot the person in the heart but the person does not die. This person did what usually kills but Allah did not will for the other person to die so he survived.
We might drive and cross a read light and nothing happens and we might cross it another time and die. It is by the will of Allah.
3- Allah is Just therefore he did mention in the Quran: (2:286){ لاَ يُكَلِّفُ ٱللَّهُ نَفْساً إِلاَّ وُسْعَهَا لَهَا مَا كَسَبَتْ وَعَلَيْهَا مَا ٱكْتَسَبَتْ
God charges no soul save to its capacity, that is, what it is capable of bearing; for it is what it has merited, of good and its reward, and against it is what it has earned, of evil and its burden: no person shall be requited for another’s sin or for what he has not earned, even if he was tempted to do it.
4- There are some things that human has no control over like his shape his color who is his parents.... if tomorrow he will get promoted or loses his job....
I hope this clear what others has been trying to say, And Allah knows best.
salam