To understand this phrase, think first about its literal meaning. If you were kicked by a mule, you would be hurt. So, in theory, you would not want to be kicked for a second time because you would remember the pain and general unpleasantness of the experience.
To give an example of this phrase in action, let's imagine that you do not study for an important test and you fail it. If you are given a second chance to take the test, consider whether or not you would study for it. Would you let yourself fail again by not studying (and, therefore, be kicked by the mule for the second time), or would you study and make sure that you pass?
Looking deeper, then, this phrase encourages you to learn from your mistakes and, more importantly, to not make the same mistake a second time.