Firstly, Judaism ABSOLUTELY believes in reward and punishment. And that reward and punishment takes place in the hereafter, for the most part. God is a God of complete and perfect justice, "who taketh not a bribe." Therefore, the bad guys will get their just desserts, as will the good guys get their rewards.
There are all kinds of variations on these themes in the Talmud. There are cases where the mitzvot and good deeds of an absolute evil person are given to the righteous whom he has harmed. And there are cases where one gets credit for having enabled another to do good deeds as well.
It is a complex arrangement, yet it is clear that Judaism believes in life after death and in ultimate reward and punishment.
There is a concept called "Gehinom", which is a form of purification. The Jewish concept of punishment is not eternal damnation. Why should someone be eternally damned if they only transgressed for a lifetime? Rather, there is a period of purification - which can be unpleasant in ways we don't imagine or want to, before we are admitted to the Presence of God in the World to Come.
In this world, however, there is also reward and punishment. It is not absolute, though, as we see eveil people prosper on occasion. The Ramban, a 13th century sage, explains that reward and punishment in this world serve a purpose of maintaining free choice. How so?
If there were no punishment in this world, hardly anyone would be able to resist the temptation to sin. Knowing that there just might be a form of "bolt of lightning" may stay many hands.
If, however, reward and punishment were absolute in this world, with every good deed being rewarded immediately and vice versa, then who would ever sin? Again, no free choice would be possible.
Thus, we are given responsibility and choice. God wants us to choose good willingly, and He keeps the options even for us to truly choose good.