Of course you can learn from failing, but you can also learn from succeeding.
Studying why something worked, even if you just stumbled upon it, can be applied intentionally to greater success in the future but only if you take the time to understand what skills and abilities you applied in the process to make it work. Working with teachers, students, children, colleagues, always try to focus on and understand why something worked, rather than only on why it fell apart.
Perhaps this is exactly what John Milton (or maybe Branch Rickey) meant when he said "Luck is the residue of design."
To really succeed, study success!