Psychology is concerned with the what and how of mental life, not the why.
Dealing with failure is easy: Work hard to improve. Success is also easy to handle: You've solved the wrong problem. Work hard to improve.