Close planets, the Moon the Sun and close by stars can have their size determined by basic trigonometry after one measures the angular size in the sky and the distance to the object (say, by parallax, which involves more basic trig).
Far away stars are more indirect. There is a way to relate a stars temperature, which is determined from the light's peak wavelength, to its expected brightness, which is proportional to the surface area. If a star is too luminous for its temperature, that means it has a huge surface area, so it's a giant.
There are other methods too, for instance If some other object passes in front of the star, it blocks some of it's light, and from how much dimming and the time it takes to pass it is also possible to infer the size of the star and/or the other body.
Goddamn I suck at math.