There are at least two ways in which to look at this question. First, we can look at the “rights and wrongs” of choosing to go to war. Second, we can look at the “rights and wrongs” of waging war. These are separate issues, but both are very important when we are looking at whether a country is acting correctly with regard to war.
In today’s world, we would typically say that it is only right for a country to go to war if it is defending itself or another country. Therefore, for example, we would say that it was wrong for Iraq to invade Kuwait in 1990 for the sake of taking territory that Iraq felt should have belonged to it. By contrast, we would say that the US and the coalition were right in going to war in order to eject Iraq from Kuwait because this was a form of defending Kuwait.
Of course, there are gray areas here. When the US invaded Iraq in 2003, it claimed that it was doing so to protect itself. However, it is not clear that this would have been justified even if Iraq had been shown to have weapons of mass destruction. It is not always clear where the line between self-defense and aggression is. However, in theory, I would argue that it is right to go to war for defense, but wrong to go to war if the other country is not a direct threat.
We also say that there is a right way and a wrong way to wage war. The right way to wage war is by targeting only members of the enemy military and trying as much as possible to avoid civilian casualties. The right way to wage war is by treating the other side humanely when they are captured. The right way to wage war is by observing international rules and abstaining from things like the use of chemical weapons. In other words, the right way to wage war is by making the process of war as humane as is possible for a process in which you are trying to kill or wound other people. It is wrong to wage war in such a way as to cause unnecessary pain or death.
Thus, we can say that there are right and wrong reasons for going to war and right and wrong ways to behave when one is at war.
I think that the example that everyone jumps to immediately is World War II as a war that is fought over what we believe is right and wrong, good versus evil. What is right was the Allied Armies stopping Germany from taking over Europe and to stop Hitler's Final Solution (the Holocaust), as well as Japan's hunt for an empire and their war crimes as well. What is wrong was the Axis Powers and their tyrannical holds on their own governments and their search for power.
However, World War II itself was iffy on issues of good versus evil... the Soviets actually were no better than the Nazis, killing millions of civilians as well in lands they conquered, yet we were willing to overlook that fact in order to defeat Germany.
War itself questions morality... Is it right to take another man's life in order to defend your own country/ideologies? What is the purpose that you are fighting? Is it because of nationalism? Is it for defense? Is it to show your own power? Is it to protect a sister country?
I think that we can look at what Otto von Bismarck says about war, “The great questions of the day will not be settled by means of speeches and majority decisions but by iron and blood.” War for many people had been a means to gain freedom and to unite as a nation. And war will continue to be waged to ensure that is protected.
War is messy... both literally and figuratively. And what is right and wrong depends on your personal beliefs.