The Law of Karma as most scriptures say is certain and no one can change what is Destined.
Why do we experience pleasure or pain? Once we know the cause, we could take appropriate action, either to overcome pain or prolong pleasure. The Law of Karma basically tells us that pain and pleasure are on account of prarabdha karma phalas-the fruit of past actions.
There are three kinds of karma. Sanchita or accumulated karma is the sum of all the total fruits, good and bad, obtained during past births. We may find a person who does not care for others and yet living a good life; the present situation that he seems to be enjoying could be for the good deeds done in his past life. If he is troubling his fellow beings in this life he is sure to live a miserable life in his future birth. This is how karma works.
Agami karmas arise from deeds that would be performed during the course of this lifetime by an individual, be it good or bad deeds or a mix of both. Remember that the rewards of this are added to the sanchita karma and therefore increase its volume.
There is a small story which emphasises that prarabdha karma is inevitable: