The cities are there because the railroads brought transportation to the area. Transportation brought the population. Population begot cities. Please read one of the many books on the settling of the US West. The same goes for the vast areas of Canada. There’s not one town in the West that does or did have a railroad running through it.
And prior to railroads was rivers. Canada’s major population centres are on the banks of major rivers, or lakes.