"If Allah were to take mankind to task for their wrong-doing, he would not leave hereon a living creature, but He reprieveth them to an appointed term, and when their term cometh they cannot put (it) off an hour nor (yet) advance (it)." (16:61) An-Nahl.
In this earthly world we have often observed that a sinful person may go unpunished leading a happy life while a good person faces injustice. This aspect often confuses people to the extent that some lose their Faith in Allah. That's because they haven't understood Verse 16:61 and many other verses similar to it. Unfortunately most folks read the Noble Quran and its translations with a wondering mind as a ritual. Thus, even if they finish reading the entire Quran 20 times, their knowledge is incredibly limited.
Verse 16:61 is a direct and clear answer why some some sinners may go unpunished in earthly world and vice-versa. If you try to concentrate on this Verse by reading it carefully, you will understand it yourself. Allah confirms the Day of Judgment by referring to it as "an appointed term." Allah states that if it wasn't for the Day of Judgment (or that appointed term), not a single wrong doer would be spared in this world. In other words, if He had not fixed an appointed time for the Day of Judgment, then every wrong doer would face justice by being punished right here in this world. But since the Day of Judgment is surely there and is coming closer with the passage of each day, therefore in many cases, Allah allows the wrong doers to have their way along with their very temporary earthly enjoyments. It's only on the Day of Judgment (a Day specified for dispensing justice) that these wrong doers and sinners will find themselves trapped, facing the punishment that awaits them, the Day which they can neither postpone nor advance. This Verse (and there are many similar verses in the Noble Quran) also reiterate that the purpose of earthly life is only a test of human conduct. Therefore, in this life we are largely permitted by Allah to exercise our own will. Some of us exercise it with wisdom even at the cost of our own suffering, but most don't. They are the ones who will face the wrath of Divine Justice in the next world - which is the "appointed term."