An uninformed stranger who enters an operating room will observe a helpless person on a table, surrounded by masked men brandishing knives and other instruments. The masked men cut and stab and draw blood, disregarding the moans of pain from the "victim," who is drugged and prevented from moving.
The stranger's natural reaction is to shout for help. As far as he can see, a group of sadists is torturing a helpless person.
If the stranger realizes that the activity he observed was actually a surgical procedure essential to the patient's well-being, he would certainly understand why the few hours of pain on the operating table were necessary. In fact, he would probably argue that the masked "villains" are great humanitarians who are performing a vital service. This impression will remain even though no doctor can guarantee a cure, or how long the patient will live, even if the surgery is successful.
From this example, you can understand that a person's life sometimes involves elements of pain and suffering. When we are caught in the middle of a difficult situation, it is not easy to appreciate the massive benefits that accrue from temporary discomfort.
The concept of Divine Providence stresses that there are no random occurrences in the world; even the painful episodes are part of the divine plan, an all-encompassing system that includes the individual, his family and every other person, thing or event that occurs.
Igros Kodesh of the Rebbe, Vol. 13, p. 171