Because, like attracts like.
If you'd like a bad situation in your life to stop, go within to identify the emotion that could be attracting this very situation and allow yourself to not fuel that emotion anymore.
Once that emotion you've identified isn't fueled anymore, the emotion isn't strong enough to attract the same energy creating the predicament, thereby putting a stop to the episode.
Life is a lesson, and emotions always lead the way.