Read 2 Corinthians 1 at Bible Gateway.
This passage forms a chiastic structure:
2 Cor 1:3-7
1a) 2 Cor 1:3-4a, The God of mercies and all comfort comforts us in all our tribulation;
1b) 2 Cor 1:4b, So that we may be able to comfort others with the same comfort we received;
central axis) 2 Cor 1:5, For as the sufferings of Christ abound in us, so also our consolation;
2b) 2 Cor 1:6, If we are afflicted or comforted, it is for your consolation and salvation;
2a) 2 Cor 1:7, We know that as you partake of sufferings, so also of consolation.
1 Corinthians 1:3-4a
Paul is talking about something amazing – that God allows tribulation to come upon His children, so that when God delivers them from their tribulation, and comforts them in the midst of their suffering, they will know how to minister comfort to others who are suffering.
In other words, we are here to be a blessing to others! That is our calling! We are not here to just live the most comfortable life we can afford for ourselves.
Sometimes bad things happen because we open the door for them. Sometimes bad things happen because the enemy is out to get us. Sometimes bad things happen randomly, because we live in a fallen world. Sometimes bad things happen, because God is testing us, and trying to grow us up and refine the dross out of our character. But sometimes bad things happen, because our experience of the faithfulness of God through the bad time, and the comfort we received from God in the middle of the bad time, and the victory God eventually gave us over the evil that happened to us, will minister to someone else down the road who is going through a bad time, and needs encouragement and comfort.
Not everything that happens to us in this life, happens to us because of us, but because of purposes of God which He knows, one of which might be to minister comfort to someone else down the road.
For further reading: 2 corinthians 1, affliction and comfort.