“Why do the nations rage.” Although it is not immediately obvious, Psalm 2 continues a theme that began in Psalm 1: the conflict between good and evil, between obedience and rebellion, between godliness and ungodliness. Both Psalms show good versus evil; Psalm 1 is on a personal level, while Psalm 2 is on a national level (but it nuances to a personal ending). So the Psalms begin with the most important theme in all existence: are you going to die, or live forever? In Psalm 1, the righteous flourish like a tree planted by water whereas the wicked will dry up and blow away like chaff and will perish. In Psalm 2, the rebellious unbelievers band together against Yahweh and the anointed king that He set up in Zion. But even banded together, their plans are futile and they end up broken in pieces like a smashed clay pot. Psalm 2 fittingly ends with an exhortation to people to pay homage to the Son. Those who refuse will perish while those who do will be blessed.
“a vain thing.” The unbelieving and rebellious peoples plot against God, which is futile. Despite the boasting of ungodly people, in reality they, and all humans, are quite powerless. The unbelievers plot “a vain thing” (ASV; NASB; NKJ); they are “devising plots that will fail” (NET); they “waste their time with futile plans” (NLT); and/or they “plot in vain” (CSB; ESV). Humans cannot control their own destiny, indeed, they cannot even determine the day of their death. So when humans plot against God they are planning in vain and their plans will come to nothing. The only way to be truly successful in this life (and the next) is to love and obey God.