While post-credits scenes can have many uses, their main purpose is to give audiences a reminder that more of the thing they just watched (and hopefully liked) is coming, usually in the near future.
It's a trend that is mainly associated with comic-book movies thanks to the success of the Marvel Cinematic Universe, but even so, it's expanded greatly over the last five to ten years, with horror movies and even dramas embracing the benefits of including some additional footage for patient fans to discuss when they leave the cinema.
Because it's such a popular thing to do, a lot of movies actually plan their post-credits scenes along with the film itself, and as a result, a lot of ideas end up being scrapped - or get as far as shooting - before being axed from the movie entirely.
Maybe the scene was too long and needed shaving down, maybe it left audiences on the wrong note, or maybe it was just flat-out weird. Whatever the case, post-credits scenes have been cut from a lot of movies, and most you'll never even get to see.