Use the phrase to show acceptance of an uncontrollable situation or outcome. Lost your basketball game today? That's the way the cookie crumbles sometimes.
Pro Tip 2/3
Casual Tone
The phrase is informal and generally used in casual conversations, not formal situations. So the picnic was rained out, huh? Well, that's the way the cookie crumbles.
Pro Tip 3/3
No Blaming
It suggests that the situation is due to chance or outside forces, not someone's fault. The flight was overbooked and I couldn't travel - that's the way the cookie crumbles.