It's a more socially acceptable version of "shit happens".
It can be used to:
1)express condolences for someone's situation without offering any
apologetic words.
2)respond to a future problems that shows a sense of sadness/aggression towards it, but in a way without trying to complain
3)to
shrug off a one's own, or someone else's, minor annoyance
4)substitute for an actual response, while still continuing the conversation
1)"My girlfriend just broke up with me"
It happens.
2)"I'm not
looking forward to this physics test tomorrow"
It happens.
3)"I think the cafeteria is out of milk. (
Ehh,
it happens)"
It happens.
4)"Sounds like you've had a long day"
Yeah, it happens.