In Psalm 82, God (Elohim, singular) stands in the divine assembly of elohim (plural)– lesser, created, divine/spiritual beings. At least some of these elohim are condemned by God for not exercising justice when governing the nations. They were supposed to govern justly concerning the poor, needy, fatherless, powerless – but they didn’t do their job. Therefore God says these disobedient elohim will die like mortals. Then the Psalmist prays that the LORD manifests His justice over all the nations – for they’re all, ultimately, the LORD’s inheritance.