It was all of the above
The idea began with the expansionist program called the Manifest Destiny, a doctrine which said that it was God's plan for the United States to grow from coast to coast.
The Homestead Act was used to encourage families to settle in new areas by providing them 160 Acres of free land on the condition that they stay there for 5 years.
The discovery of Gold and the development of railroads further helped make it easy and more attractive to settle in western lands.
When modernization reached the west coast and populations increased, these areas became attractive areas of settlement for everyone