There's a survival advantage to forming long-term memories. But that survival advantage isn't paid off immediately -- it may not be paid off ever, and if it is, it'll be not for a long time. There is no immediate feedback.
Often, when there is some activity which is good for the survival of the individual or the species, but whose benefit isn't immediate, the body is wired to reward it with a sense of pleasure. Sex is only the most obvious example: there are many other activities which instill simpler senses of pleasure that condition us to do things as ordinary as going to the bathroom and as long-term as bonding to our children.
It's my pet crackpot theory that nostalgia, that positive glow we get thinking back on something in our pasts, is just a positive reinforcement to the act of reinforcing memories. Surely you've experienced that sensation where you just remember something and there's a sort of positive feeling even though the memory itself is not particularly positive (or negative), and where there's really nothing to say about it or add to it. (This is most evident in long-bonded couples saying, "You remember when..." and then nothing more comes of it -- just the act of remembering it and sharing that memory is enough.)
Nostalgia also helps explain why things are often better in recollection than they were at the time. Other explanations are often offered for this: most notably, how we tend to forget the bad parts or downplay them, but remember the good parts. Or how that nostalgic sense about the "good old days" is a hardwired, psychological counterbalance to our hardwired, psychological neophilia, to help us stay poised between change and stability. While I think those things are certainly part of it, I suspect the positive reinforcement of the making and reinforcing of memories is more fundamental.