In general, countries go to war to preserve, extend or defend their territory and way of life. More specific motives include gaining access to new land or new economic resources, perpetuating or defending religious beliefs, and bringing a swift end to a political conflict.
There are limited resources in the world. Some countries have more ample access to desirable natural resources than others. When one country has something another country wants or needs, the country lacking resources may seek to gain access through warfare. Land is also a limited resource, so countries seeking economic expansion may aggressively attack other countries to seize land for its resources or to develop it.
Religion has long been a trigger in wars. The Crusades were among the most prominent wars that took place over religious convictions. In that instance, it was an effort by Christian groups to seize control of Holy land from Muslims. Conflicts within a country often start based on different religious or philosophical differences among the people within a nation's borders. The goal of each side is often to gain control of the government to implement desired policies. Similarly, political rhetoric or differences within countries and between countries can eventually become so tense that diplomacy is left behind in exchange for war.