Sometimes when you're writing suddenly there's a flash that solves the problem you';re been having with the story. This has happened to me many times. Some people find inspiration in dreams. Why do these occur. This is the unconscious working. This is part of you that usually remains silent but this is the place where creativity is born.
Often this spurt from the unconscious goes against what is the usual and ordinary. As a writer, you can ignore this. While writing a mystery story I once hit a block since the weapon was something the heroine's near and dear all owned. She was very protective. I woke up one morning and I knew what she was going to do. Throw the knife in the Hudson River. A heroic act, not really but one that was true to her nature but not to what people expect of the heroine of a mystery novel. 99 rejections later (Maybe not that many) the book was published and is one of those that continues to sell nearly 14 years after first published. To quote from Rollo May -- The insight is born with anxiety, guilt and the joy and gratification that is inseparable from the actualizing of a new idea or vision. --
So don't be afraid of those "bolts from the blue." Explore them and see where they lead.