How do astronomers know the size of the universe?
They don't actually. What they have now as its age is an educated guess but they admit they could be way off.
Astronomers speculate the size of the universe to be 47 billion light years. One way the do this is by approximating the distance of the cosmic microwave background (the "sound" the big bang made).
This is very problematic because they have fairly well nailed down the age of the universe at 13.7 billion years. If you accept that nothing can go faster than the speed of light, as is considered axiomatical, then that should also be the size of the universe if the most distant objects moved out from the big bang at the speed of light.
The fly in the ointment is that in the fist few billionths of a second the universe was in its "expansion" phase. During the initial expansion it became half the size it is today. That means energy moved at speeds well in excess of the speed of light.
Then the expansion slowed way down and objects were created out of energy. As astronomers have studied thousand of galaxies they have found one constant, every galaxy appears to be moving away from every other galaxy and the rate of separation is accelerating. They are at a loss to explain this phenomena.