Sometimes the investor relations departments give an “official” consensus that they use as reference (at least some ex-US companies do so). For example, see the link to the Vara-provided consensus at https://www.investor.bayer.de/en/stock/analysts/consensus/
The whole business of beating consensus is a bit of a farce, as the forecasts are continously revised (sometimes the company will directly tell analysts that expectations have to come down). So it can happen that the results are 1% above the current forecast, but the current forecast is 10% below where it was one month ago.
For example, looking at the evolution of Q2 estimates for Tesla:
One year ago, the EPS forecast was -0.37. Two months ago it was -2.19, last month -2.26. Now it stands at -2.29, and it may be revised down now that Q1 results are available.
As we get closer to the end of the quarter the trend may continue. If, for example, right before the earnings announcement the consensus estimate is -3.25 and the actual EPS is -2.90 then it will be a strong beat...
I'm no insider, but I feel like a lot of this comes down to Bloomberg terminal. That seems to be where lots of people get their aggregates of estimates, at least as a common starting point.