The Midrash in Koheles Rabbah (7:4 in the Warsaw numbering) writes (translation follows Artscroll, chapter 7, page 31):
נולד אדם הכל שמחין מת הכל בוכין. ואינו כן אלא נולד אדם ואין שמחין לו שאין יודעין באיזה פרק ומעשים יעמוד אם צדיק אם רשע אם טוב אם רע. ומת הם צריכין לשמוח שנפטר בשם טוב ויצא מן העולם בשלום.
When a person is born, everyone rejoices, and when he dies, everyone weeps. But it should not be so. Rather, when a person is born, people should not rejoice over him, for they do not know which challenging situations and actions he will have to stand up to, whether he will be a Tzadik or a Rasha, whether good or evil. But when he dies, then they should rejoice, for it is then that they can see that he has departed from the world with a good name and he has left the world in peace.
The Midrash illustrates with a parable: people rejoice over a ship leaving the harbor but not over one entering. It really should be the other way around - the one leaving could get hit by storms, winds, and hurricanes, while the one entering should be rejoiced upon for its successful arrival.
In practice, though, this isn’t the case. Although it’s certainly natural for one to rejoice over a newborn and for one to mourn over the loss of a close one, why do we not find any Halacha that dictates that we should do the opposite?
(It should be pointed out that one reason given for Lag BaOmer is celebrating R’ Shimon bar Yochai’s life - not mourning his death. See Aruch HaShulchan 493:7, and further here.)