The modern understanding of this is that McKinley wanted to throw some elbows and expand America's interest abroad and a new feeling that America should be an imperial nation. This ultimately meant going to war with Spain to "protect" and "help" the people of the Philippines and Cuba by controlling and occupying two very important strategic territories for naval supremacy.
At the time, the war was explained by the explosion of the USS Maine "Remember the Maine!" which actually exploded because of faulty wiring.