Edit: I get it, lots of american towns still have them. What I'm asking is why they originally came about.
American expansion always included strong elements of boosterism: wanting to believe that your town was bigger and better, or would soon be bigger and better, than other nearby towns. Because I’ve never seen any suggestion that population signs were posted for view by passing railway passengers, I believe the practice really arose in the early days of automobiles and cross-country motoring. In much of the nation, the new highway network was cobbled together from pre-existing county roads, including the section-line roads that run parallel at one-mile intervals. With so many routing possibilities, there was great rivalry among small towns to be on the new marked route that would attract motorists, and I speculate that booster clubs put up signs at junctions and crossroads touting their towns: listing the services such as hotels, repair garages, and tourist campgrounds to be found there, and also showing a population figure that would suggest a greater variety of eateries, services, and attractions. No doubt there was some inflation of those figures, and so state highway departments and their official signs noting entrance into municipalities became the trusted arbiter of such figures.
Some states also show the altitude of towns on city-limit signs, a holdover from railway days when that was a figure of interest to both the drivers of the locomotives and travelers passing through. In the early days of motoring, altitude was also a factor in engine adjustment and performance, and useful for motorists to know.
Alas, I’ve never found much in the way of sources on this topic, so its informed more by broader understanding of the rise of the automobile and civic rivalry in the early 20th century. The rivalry of towns wanting to be included on the pioneering coast-to-coast Lincoln Highway is chronicled in Drake Hokanson’s book The Lincoln Highway: Main Street Across America. John A. Jakle and Keith Sculle’s book Motoring: The Highway Experience in America gives a pretty good picture of the landscape that faced early cross-country motorists. The various papers in Roadside America: The Automobile in Design and Culture, edited by Jan Jennings, give more detailed insight into various aspects of the roadside culture.