Here’s a wonderful excerpt from the Institutes on prayer.
“The fourth rule is that, thus cast down and overcome by true humility, we should be nonetheless encouraged to pray by a sure hope that our prayer will be answered. These are indeed things apparently contrary: to join the firm assurance of God’s favor to a sense of his just vengeance; yet, on the ground that God’s goodness alone raises up those oppressed by their own evil deeds, they very well agree together. For, in accordance with our previous teaching that repentance and faith are companions joined together by an indissoluble bond, although one of these terrifies us while the other gladdens us, so also these two ought to be present together in prayers. And David briefly expresses this agreement when he says: “I through the abundance of thy goodness will enter thy house, I will worship toward the temple of thy holiness with fear” [Ps. 5:7].
Under God’s goodness he includes faith, meantime not excluding fear. For not only does his majesty constrain us to reverence but through our own unworthiness, forgetting all pride and self-confidence, we are held in fear. But “assurance” I do not understand to mean that which soothes our mind with sweet and perfect repose, releasing it from every anxiety. For to repose so peacefully is the part of those who, when all affairs are flowing to their liking, are touched by no care, burn with no desire, toss with no fear. But for the saints the occasion that best stimulates them to call upon God is when, distressed by their own need, they are troubled by the greatest unrest, and are almost driven out of their senses, until faith opportunely comes to their relief. For among such tribulations God’s goodness so shines upon them that even when they groan with weariness under the weight of present ills, and also are troubled and tormented by the fear of greater ones, yet, relying upon his goodness, they are relieved of the difficulty of bearing them, and are solaced and hope for escape and deliverance.
It is fitting therefore that the godly man’s prayer arise from these two emotions, that it also contain and represent both. That is, that he groan under present ills and anxiously fear those to come, yet at the same time take refuge in God, not at all doubting he is ready to extend his helping hand. It is amazing how much our lack of trust provokes God if we request of him a boon that we do not expect.” (Inst. III.xx. 11)