There is a pasuk in Torah that says "Those whom Hashem loves, He chastises". 
When anything goes wrong in life or when someone goes through suffering (chasve shalom, may we all merit only open revealed good)  we think , as little children would think when their parents punish them, that our Father is angry with us and we are not pleasing to Him. That often brings feelings of sadness or depression. Feelings of being unworthy, somehow lower than others who have it "good" in life.
However, when we think deeper, a parent who truly loves their child, wants their child to be the best, to express their true potential, and the parent expects MORE from that child. Hence, a parent may punish a child that they know could do better and that they know could reach a higher level. So the punishment becomes a means to elevate that child. It is from love, not anger. If a child is a "good" child, we expect more from that child. A child who is misbehaving and not giving us so much nachas, we do not expect as much from…although we still pray that the child will do teshuvah and return, and sometimes we also need to use harsher measures or even a bit of aloofness to bring that child back. 
The same with Hashem. When He loves someone, He sometimes wants to bring that person to a higher level and to reach a greater spiritual perfection , so He brings various "problems’ or difficulties to that person. Sometimes it is  a test, sometimes it is a form of purification, sometimes it is an expression of love that is so high it cannot feel like love in this world…..
We pray to have only open revealed good and to reach those levels without the need for suffering or without the need for gevura. And yet, if we are challenged by any difficulties in life, it helps to keep a positive attitude and to remember Hashem loves us and we can respond with love by growing positively, improving ourselves, purifying ourselves, doing more teshuvah and giving more nachas to our Father in Heaven. 
When we do that, accepting afflictions with love, the sefer Tanya tells us that we then sweeten the dinim and everything turns to open revealed good so that we are able to appreciate the hidden kindness behind everything and to actually see the good. then everything turns to goodness and happiness.  
Galus is the same idea. Hashem sent us into galus because He loves us. And through galus we reach a much higher level. But we now pray that Hashem should end the galus and reveal His hidden kindness and redeem us so we can truly serve Him with simcha.