The formation of the UN created a new mechanism for collective military action to be sanctioned by the Security Council, and placed strict limits on when countries are allowed to go to war without such approval, with the main scenario where it is allowed being self-defence. Most countries have not felt the need to declare war when participating in UN actions, and in other cases they have tried to portray their wars as emergency defensive actions, which would be undermined by a formal declaration of war. In both cases, they have also tended to want to play down the scale of what they are doing, portraying it as a small, limited military operation rather than a full-blown war.
Though there have been a few formal declarations of war in recent decades, such as the Iran–Iraq War, and there were plenty of undeclared wars prior to the modern era.
“War” has a specific, legal definition. With all the various treaties that countries have signed, like NATO, the UN, the Geneva convention, a “legal war” (if there is such a thing) has to meet certain conditions. If those conditions are not met then there are some international sanctions that can be applied.
Going back to all those treaties, a formal declaration of war against a county can trigger all sorts of mutual aid agreements causing war on a global scale. Look at WWI for example.
A good number of countries require approval from a legislative body which can be relatively difficult, like the us needing 60 votes in the senate. A lot of countries put conditions in place that can limit a nations leader from doing certain things.
The world is a lot more interconnected these days through global trade, meaning it’s incredibly expensive (not just in terms of fighting but also from lost trade and economic output) to be at war.
We also have the United Nations as something of a global arbiter of what can or can’t happen and diplomatically “war” can’t really be talked about. When Iraq was invaded in the early 2000s it was after the approval of a UN resolution with the language “by all means necessary” – which is diplomat-speak for war.
Latest Answers