Often, religion is used to demonstrate optimism by stating that God, or a higher spiritual power, promises victory to the country ( I found this on the internet) What does this mean and can it be an ideology? (We have to be pro-war that's what the teacher said) I'm kind of confused about it.

You remind me of something that was written at the turn of the century, and got the author in deep trouble with the Queen (Victoria). A hundred years earlier, Sammuel Johnson had stated that Patriotism was the last refuge of a scoundrel. This gent stated that Religion was the first refuge.

Since those days, another author has added prayer as the final refuge.

What they are all saying (except Queen Victoria) is that folks will justify evil, including war, with anything that is likely to appeal to the the emotions of the populace. The authors stated, with some justification, these folks were scoundrels, and I have to tell you that with some exceptions, I generally agree with them. During my lifetime, most wars have been for economic purposes, conceived by folks who had things to gain, but presented the war in a nice, neat package that made the war so patriotic, and such a service to God. Recently, we had a justification of war to rid the threat of weapons of mass destruction as the cover for oil security. See how scoundrels think? If one can cover evil with a sprinkling of good, how tasty it can appear.