Desolation can be understood as a darkness of the soul. It is a spiritually uncomfortable disturbance of the soul that leads to a movement to things low and earthly (in the sense of decay and corruption). Desolation brings about an unquiet of different agitations and temptations. It moves a person to a lack of confidence. It can leave a person without hope, without love, tepid, and sad. It can make a believer feel as if separated from the Divine Creator and Lord. Desolation comes to a human being through the work of a spiritual entity they likely cannot see or even know is present.
God never causes a person to go into desolation but does allow it. God may allow desolation as a trial. God may allow it for a person to resist the different agitations and temptations of the enemy, since a person can, with the Divine help, (which always remains to him, though he does not clearly perceive it) resist the desolation. A person can come to desolation because of being tepid, lazy, or negligent in spiritual exercises. Finally, and I struggle with this one, God may allow desolation to remind us that any consolation we may receive is because of grace and not of our own doing.
Those who understand the power of desolation know that in time of desolation a person should never make a change (a choice or decision), but to be firm and constant in the resolutions and spiritual determination in which one was in preceding such desolation. This can be a very difficult thing to do. One of the reasons it is so difficult is that in desolation it is the dark (evil) spirit that is seeking to affect our thinking and deciding and will not do so in our favor. Another reason is the pressure our culture puts on us to believe we can create our own consolation through material possessions, ego-related positions, or self-acquired pleasures. Whereas these things may mask desolation, they cannot cure it.
Although I stated that in desolation we ought not to change our first resolutions, it is very helpful to (with intensity) set ourselves against the same desolation, as by insisting more on prayer, meditation, on much examination, and by giving ourselves more scope in some suitable way of doing penance.
Overcoming desolation takes a commitment and work toward patience, which is contrary to the spiritual pain and darkness which come to one in desolation. It is very helpful to think that one will soon be consoled, employing against the desolation the promises of God and the experiences of a mature faith. God does love us. God does care. We can endure and overcome. Just know it will not be easy.