It’ll vary depending on things like how long the story is, whether you’re planning on continuing the story in a series/spinoff story/etc., and the overall mood of your story.
If you aren’t planning on continuing the story in any way, you’ll want to wrap up any loose ends before you close it all off. This usually means having a satisfying (not necessarily happy, but definitive and final) ending to each subplot and side character arc in addition to the main plot. Of course, some stories do have open endings or cliffhangers, but unless you do this extremely well the readers may just feel like it’s a cop out, even if you planned it that way from the beginning. (And even if you do it very well, there will always be people who hate cliffhangers/open endings of any kind. This doesn’t mean you shouldn’t do them, but it’s something to keep in mind.)
As far as deciding on a “happy ending” or not, I know it’s tempting to make everything work out great and all the characters frolic off holding hands into the sunset, but that doesn’t always work for every kind of story. Of course, if you’re writing a comedy, a fun upbeat coming-of-age YA novel, or something like that, an all-out happy ending can work and makes sense. But for a lot of genres, an at least slightly bittersweet ending is more realistic and will probably feel more natural to the readers. For example, think about how the Harry Potter books end– there are major character deaths and a lot of destruction and those parts are heartbreaking, but the main villain is stopped and peace is basically restored. The mix of happy and sad makes sense for the genre and the mood of the story. In fact, the Harry Potter series is a great example of story structure – check out this infographic.
Here are some links that might help: