When the market shifts or your product fails, here's how to stay sane and adapt without losing momentum.