Everything a person does, even if he is in a hidden place, is seen by Hashem. Hashem knows all. Hashem knows what will be. Hashem has an understanding of all past, present, and future. Because of that, a person may think that there is no free will. If God knows the future, the future is sort of set in stone, and a person would not have freedom of choice to choose what he wants to do. That is why the Mishnah continues: even though God knows everything and knows what a person will do, a person still has permission to do what he wants, whether it is a mitzvah, positive, or an averah, and it is evil. So the fact that God knows everything, what will be, even though it is paradoxical, does not mean that a person does not have freedom of choice to choose what he wants to do. Because a person has freedom of choice and his actions are chosen by him, God judges everyone. A person who does good will receive sachar, will receive reward. A person who does bad through an averah will receive punishment from Hashem.
But at the same time, everything is done with goodness, which means God judges everyone with mercy. God gives even the biggest resha'im (wicked people) mercy. The mercy is expressed as time. Hashem gives even the wicked people the ability to do teshuvah (repentance). The punishment is not immediate, but is delayed in order to give the person the ability to introspect and come to terms with how they should act, hoping that they repent, that they do teshuvah. If a person asks for forgiveness and changes his ways, even if he was the biggest rasha (wicked person) in the world, he has the ability to change and improve, and for Hashem to wipe away his previous actions. It all depends on how many good deeds a person has done. Even though Hashem judges everybody with this midah (attribute) of rachamim of mercy, it does not happen that everyone receives an equal measure. A person who does more good deeds, more mitzvot, more chassadim, more acts of kindness, will be shown more mercy by Hashem. The greater the person, the more mercy he is shown.

