Generally a railroad would put out to bid for a group of locomotives with certain specifications, in otherwords type (Mikado) purpose (general service) maximum weight, maximum clearances, etc.
Sometimes specific appliances were included. Then the builders would draw up plans and submit them to the railroad with a price quote per unit.In some instances the railroad would design the locomotives in house and then put the actual building out to bid.
Some railroads patronized only one builder, such as the Pennsy (Baldwin) or the NYC (Alco), while others were strictly on the lowest bid basis. All of the EBT's new locomotives were Baldwin built. Brooks supplied most of the motive power for the NG lines built in PA in the 1870's. Sometimes it was the proxitmaty of the builder, or the personal preference of the superentendent of motive power that ultimately made the difference.