This phrase is used for telling the final result of something. It can be used when telling stories, like in the example above. It can also be used for predicting the future consequences of an action:
If you keep missing classes, you're going to end up failing your grade and having to repeat it.
Another phrase that's similar to "end up" but more casual is "wind up":
After we left the bar, I wound up going over to James's place and sleeping on the couch.