The human brain is a complex, self-organizing system.
Changing the destructive things you say to yourself when you experience the setbacks that life deals all of us is the central skill of optimism.