We all advance at a different pace. Sometimes due to us not being prepared, sometimes just being beat out and other times factors we can't control come into play.
No matter what the reason, use a promotion lost as a learning experience. Not only about the process itself, but where to improve.
Use the time to gain more experience, master the craft and to prove you're the best candidate.
No sulking, no complaining and no excuses! Get better and persevere!
Making the best of a tough situation is the foundation of being a great officer, even when you're not.