Resigning, as mentioned by Arlen, is a respectful act. It states that you believe it is no longer worth your time and their time to play out the game. It is recommended that newcomers not resign as often as the experts appear to do.
I would like to add to that answer with more of an explanation why. Often the reason is "the other person might make a mistake that you can capitalize on." It is true that this is a natural reason why beginners would choose not to resign, while experts resign quicker. However, there is a deeper logic which may help you identify when to resign: Chess is a game.
People play games for many reasons. Some simply play to win, but in the early levels, everybody plays to learn something. Both players enter a game with some reason to play it. If the game is no longer satisfying those reasons, there's no reason to continue it.
At the lower skill levels, it is worth playing every game to its fullest, simply to learn. Chess is a complicated game which takes time to learn completely. For instance, you may know that you are 3 moves away from entering a Queen+King vs King endgame (which is known to be completely lost for the person with just a King), but there's still some value for both of you to play it out. Your opponent gets an opportunity to practice a key mating pattern, and you get to practice trying to capitalize on any mistakes they may make. One of those mistakes may help you in a later game: you may realize that a particular Queen+King vs. King endgame is not lost because the particular position happens to cause a forced stalemate. You might never realize this if you hadn't taken the time to play out the earlier game to its fullest.
As you get to the higher ranks, you will become more aware of which positions are interesting to play out and which ones are simply dumb. An expert will understand the difference between a position where they are simply "behind by a Queen" and a position where they sacrificed a Queen to gain some tactical advantage. They will understand where "gains from winning the game" multiplied by "probability of my opponent messing up and letting me win" is less than the psychological stress of playing the game out.