The imperialism of these centuries was based on a number of "desires, needs, or attitudes."
First, there was the desire or need for money. One of the greatest causes of imperialism during this time was economic. This is why the British took control of India, and why it forced concessions from China.
Second, there was the desire or need for military power. This was a major reason for the US to take places like Puerto Rico, Guam, and Hawaii.
Finally, there was the attitude of racial superiority. Countries like the US and Great Britain argued that they were spreading superior civilization and culture by taking empires. This was a major reason why the US ended up taking the Philippines as a colony.
All of these were reasons for the imperialism of the time period that you mention.
The ideology of imperialism is quite complex as no historical phenomenon has just a single cause.
The first key need or desire was economic. This was the period of the Industrial Revolution and many European countries sought to profit by obtaining raw materials from Africa, the Americas, and Asia and then selling those countries finished goods. There was also, especially towards the end of the nineteenth century, the motivation of what economists call "labor arbitrage," outsourcing production to places with lower labor costs.
The next motive was geopolitical. Many of the European countries were vying with each other for power. This played out on a global scale with, for example, the French, Spanish, British, Dutch, and Portuguese expanding into the Americas, Asia, and Africa—primarily to keep ahead of or forestall their European rivals.
Another major impetus was religious. Christianity was an evangelical religion, and many churches sent missions to Christianize "heathens" because they believed that it was their duty to "save" them. In many cases, Christian missionaries worked closely with national governments and were supported by them.
Finally, many wealthy developed nations believed in what Kipling called "the white man's burden," a duty to "civilize" what they saw as inferior peoples.