Question: If you say that Hashem determines what occurs in the world, then why do we exert effort? Hasn't Hashem has already decided what will happen? If a sick person will be cured, why should the doctor toil? And if you say that people determine what occurs in the world, everything will be out of control and a mess. What will happen to the world? Oy vavoy!
Answer: Both Hashem and people determine what occurs. How do these work together? Many of our Sages discuss this subject and provide various answers, but the most simple explanation is that Hashem causes good to be brought about through the agency of righteous people and bad to be brought about through the agency of evil people. This means that Hashem decides the outcome and we decide the means. For example, Hashem decides that a sick person will be healed and the doctor decides that it will be through his agency because he works with self-sacrifice to save him. The Gemara in Shabbat (32a) discusses the Mitzvah of the "Maakeh", which says that a person must build a guardrail around his roof. Why? The Torah literally says, "Because a falling person may fall from it" (Devarim 22:8). The Gemara responds that of course a falling person will fall off the roof, who else will fall off a roof – a person who is not falling? Our Sages state that the reason he is referred to as a "falling person" is that Hashem has decreed that he will fall. But if it was decreed that he will fall than why do we have to make a guardrail? If it was decreed that he will fall, he will fall even with a guardrail, and if it was decreed that he will not fall even without a guardrail he will not fall. Answer: Hashem decreed that he will fall with or without a guardrail, but if he falls and you have a guardrail, you are not held responsible. If you did not make a guardrail and he falls, however, you are responsible – woe to you - because bad occurred through the agency of a person lacking merit.
Another example is brought by Rashi on the Torah (Shemot 21:12): There are two men, one who killed inadvertently and should be exiled to one of the cities of refuge and one who killed intentionally and should be killed. There were no witnesses, however, to either event. Thus, the first was not exiled and the second was not killed. Hashem brings them together in one inn. The one who killed inadvertently climbs a ladder, slips and falls onto the one who killed intentionally, and kills him. As a result, the one who killed intentionally is killed as he deserves and the one who killed inadvertently killed inadvertently again. He is exiled since there are many witnesses in the inn. This is called, "Wickedness comes forth from the wicked" - Hashem causes bad to be brought about through the agency of evil people.
Obviously, good also comes through the agency of good people. Massechet Semachot (chapter 8) says: Do not think that the entire Redemption was in the merit of Moshe Rabbenu, and if it were not for Moshe Rabbenu the Nation of Israel would not have been redeemed. Good comes through the agency of righteous people. It occurred through Moshe Rabbenu because of his righteousness. The Pesach Haggadah says: "Me and not an angel, Me and not a seraf, Me and not an agent." But was Moshe Rabbenu an agent?! Even though Moshe Rabbenu was the national leader and divine messenger, do not think that the Redemption was dependent upon him. If it was not Moshe Rabbenu who brought us out, Hashem would have found somebody else. Our Sages also say that the Torah had to be given to the Nation of Israel, and even without Moshe Rabbenu, Hashem would have found another messenger (ibid.). The Temple would have been built even without David and Shlomo. And the Jews would have been redeemed in the time of Haman, even without Mordechai and Esther. It is written explicitly in the Megillah, "For if you continue to remain silent at a time like this, relief and salvation will come to the Jews from some other place" (Esther 4:14). And so too, on the other side: even without Pharaoh we would have been enslaved, and even without Nebuchadnezar we would have been exiled. Good things are brought about through the agency of righteous people and bad things are brought about through the agency of evil people. Hashem has many agents, and many snakes and many scorpions. Question: Why were the Egyptians punished for oppressing the Jews when the Torah says (Bereshit 16:13): "Your offspring will be strangers in a land not their own, they will serve them, and they will oppress them four hundred years"? The Rambam explains that the Egyptians did not oppress the Jews because Hashem forced them to do so, but because they wanted to do so (Hilchot Teshuvah 6:5). What would have happened if none of the Egyptians wanted to oppress us? Do not worry, when there is a need to oppress the Nation of Israel or to perform evil in general, there are always plenty of volunteers. So too, when good needs to be performed in the world – there are plenty of volunteers. "For Hashem will not cast off His Nation, nor will He forsake His heritage" (Tehillim 94:14).