Define failure. Often failure is nothing more than proving that there is a better way, and eliminating a lesser possibility. In such a case, one man may see a failure, but in truth, it's a success. I believe it was Edison who commented that he had successfully found some 2,000 ways for a light bulb not to work, before developing a working example. He eliminated all the ideas that did not work, and in so doing, created a source of light. Others saw his former attempts as failures, but he saw them as steps to success.
Rather than ask what caused you to fail, ask what is helping you succeed.