Eject key no longer working
To fix the problem you should try to see if the problem is hardware or software.
We are going to rule out software because of the hardware testing that was completed.
As noted in OP's comment

... But I tried connecting the wireless keyboard to my MacBook, and the Eject key did not work there too ...

Since this problem persisted across multiple macs that strongly points to a hardware issue with the eject key on that Apple wireless keyboard.
If your Mac that the keyboard came with still has some coverage under AppleCare then Apple should cover repairing or replacing the keyboard according to  AppleCare - Mac and Apple Display Coverage

What’s covered — Mac

Your Mac computer

Included accessories such as the power adapter