If you have made mistakes, even serious ones, there is always another chance for you. What we call failure is not the falling down, but the staying down.
1) The kappa, or mystery element. This is the part that cannot be analyzed. There's no how. Divine inspiration, poetic madness or (in the words of Warren Ellis) two ideas mating in your hindbrain like lizards in a swamp. We can use metaphors to describe how it seems to us, but it can't be taught. There is no concept, then suddenly there is. It's our human version of ex nihilo creation.
2) The work. Honing your skills, learning your craft, expanding your toolbox, but most importantly, spending time sitting down and writing. Regularly. If you don't keep this part of you constantly working, then you're more likely to miss the mystery when it speaks, because you haven't trained yourself to listen. Without a working gun, you'll never be able to fire the bullet.