The questioner quoted the following 2 slokas from Srimad Bhagavad Gita:
यं हि न व्यथयन्त्येते पुरुषं पुरुषर्षभ।
समदुःखसुखं धीरं सोऽमृतत्वाय कल्पते।।2.15।।
O (Arjuna, who are) foremost among men, verily, the person whom these do not torment, the wise man to whom sorrow and happhiness are the same he is fit for Immortality.
सुखदुःखे समे कृत्वा लाभालाभौ जयाजयौ।
ततो युद्धाय युज्यस्व नैवं पापमवाप्स्यसि।।2.38।।
Viewing alike, pleasure and pain, gain and loss, victory and defeat, you should get then ready for the battle. Thus you will not incur sin.
We have to remember/understand, at least theoretically, the background of the Gita and higher concepts of Spiritualism.
The duals like pleasure and pain, gain and loss, victory and defeat, etc, will occur in a person's life, according to the prArabdha (stored merit of early births).
Some wise people compared the above mentioned duals to ups and downs of waves of a sea and some more wise to oscillations of a pendulum of Clock.
That what goes up has to come down (in the case of waves of ocean) and that what goes to one extreme has to necessarily move to other extreme.
Again happiness on various occasions are only temporary as in the case of sorrow.
Happiness obtained through winning an examination, getting married, gratification out of sexual intercourse, begetting children, etc, are all temporary.
If they are permanent, can a person after begetting children be happy forever? No. The upbringing of children will engulf the same person with lot of tensions, pressures, etc.
Even if a person try to avoid sorrow and be happy all the time, his prArabdha will not allow him to be in that happy mood. Whether a person is interested in doing some work, which will engulf him with lot of pressures and worries, he will be dragged into doing so by his prArabdha.
Again, whether he asks for happiness or not, his prArabdha will drown him with happy moments and luxuries.
So Sri Krishna is advising the spiritual aspirants in general and Arjuna in particular to view the events, which are only a passing clouds, with equanimity, which state is also known as sthitapragna, and which will also result in mOksha or liberation or elimination of rebirth.