WW1 was a result of industrialization causing major rearrangement of power multiplied by old habits of warring with each other. They thought "we will fight a little and it will all be good afterwards". Unfortunately military "progress" was such that it ended up in complete disaster for everybody.
The key decision makers, particularly in the case of Germany, Austria-Hungary, and Russia, all anticipated a long war, and (particularly in the case of Germany) were not so much confident of victory, as they were confident that later war would result in a far greater probability of defeat.
The German leadership were belligerent and fearful - their main fear being that if they didn't strike early enough, the decline in power of their allies and the rising power of their enemies (particularly Russia) could make any future war un-winnable.
Kind of how the US might feel, if they were to see a possible future enemy developing the ability to launch a nuclear attack on the continental US. Or how China might feel if they were to see a possible future enemy preparing to invade a 'buffer zone' and potentially station troops right on their borders.