Original: It is typically used when Homer injures himself, realizes that he has done something stupid, or when something bad has happened or is about to happen to him.
Simplified: The quote is normally used when Homer hurts himself, finds out that he has done something stupid, or when something bad has happened or is about to happen to him.