Much of the west had checkerboard lands given to the railroads as incentive to build them, It wasnt all by rail right-of-ways, much of it was scattered, but it gave them title, capital on paper, and probably some leverage for financing. Some hadnt been sold off until fairly recently. In the late 90s I bought a 1/4 section from the first owner since the railroad, I think he only owned it a year before I bought the 1/4.
Some other gov lands were checkerboarded for schools, as was mentioned, some for state, BLM, and other agencies. Much of it is pretty inaccessible for most uses and ends up being grazing leases. I know of one full section of former railroad land that was sold, it was so hilly, as in sidehill, and very poor access and very poor building potential. It sounds cool at first, but the obstacles to actually using it were pretty substantial.
The first whites that came to most places in the west homesteaded or otherwise claimed land, whatever was left unused ended up gov lands. In much of the west, the majority of the land is still gov lands. Its hard to grasp if from the east or more settled places, but there is still vast areas with few people and not much use, much of it is usable by the public with few restrictions, and part of the draw of the western country. When I first built my cabin on the 1/4 section, (I actually split it up and only kept 40 ac), I could see for miles along the mts, and could only see one light at night from a ranch miles away. It was absolutely awesome.
The silence and darkness intimidate some, to many, its part of the reason to love it. When i walk outside my current place, theres some humans around, but its generally very quiet. i can hear the sound of tires on pavement 2 or 3 miles away. Coyotes are common, ive heard wolves a couple times. You can sometimes hear people talking in conversational tones when they are outside from a 1/2 mile or more away when conditions are just right.