Often, but far from always. Sometimes it's over ideology, who's got the biggest.. well you know, all sorts of things. WW-I was only marginally about getting territory, and the territory had already been gotten by the Austria-Hugarian Empire. It was more about the "big.. " factor. It was a damn bloody war that wrecked the economies of most of the participants, and the political systems of others.b
Similarly the US Civil war was more about ideology than getting stuff.
The Civil War was fought over territory. If the Confederacy had abolished slavery and decided to secede anyway, would Lincoln have allowed them to leave and ended the war?