How did 'WE' determine the distance between the rails?

The U.S. standard railroad gauge (distance between the rails) is 4 feet, 8.5 inches.
That is an exceedingly odd number.

Why was that gauge used?
Because that's the way they built them in England, and the U.S. railroads were built by English expatriates.

Why did the English build them that way?
Because the first rail lines were built by the same people who built the pre-railroad tramways, and that's the gauge they used.

Why did "they" use that gauge?
Because the people who built the tramways used the same jigs and tools that they used for building wagons, which used that wheel spacing.

So why did the wagons have that particular odd spacing?
Well, if they tried to use any other spacing, the wagon wheels would break on some of the old, long distance roads in England, because that was the spacing of the wheel ruts.

So who built those old rutted roads?
The first long distance roads in Europe (and England) were built by Imperial Rome for their legions. The roads have been used ever since.

And the ruts in the roads?
The ruts in the roads, which everyone had to match for fear of destroying their wagon wheels, were first formed by Roman war chariots. Since the chariots were made for (or by) Imperial Rome, they were all alike in the matter of wheel spacing.

The U.S. standard railroad gauge of 4 feet-8.5 inches derives from the original specification for an Imperial Roman war chariot. Specifications and bureaucracies live forever. So the next time you are handed a specification and wonder what horse's rear end came up with it, you may be exactly right, because the Imperial Roman war chariots were made just wide enough to accommodate the back end of two war horses.

Thus we have the answer to the original question.

Now for the twist to the story.
When we see a space shuttle sitting on it's launching pad, there are two booster rockets attached to the side of the main fuel tank. These are solid rocket boosters, or SRB's. The SRB's are made by Thiokol at their factory in Utah.

The engineers who designed the SRB's might have preferred to make them a bit fatter, but the SRB's had to be shipped by train from the factory to the launch site. The railroad line from the factory had to run through a tunnel in the mountains. The tunnel is slightly wider than the railroad track, and the railroad track is about as wide as two horses' rumps.

So, a major design feature of what is arguably the worlds most advanced transportation system was determined over two thousand years ago by the width of a horse's rear end!

Amazing huh!