Hi there,
A referral is just a door opener such that the recruiting team will look through your application more thoroughly. Depending on the seniority, tenure and advocacy of the person referring you, you have a better chance of getting a first round interview. The more senior (manager level and above) the person referring you is, the better. The longer the tenure of that person with the firm is, the better.
The reason is that such voices carry more weight than referrals coming from super junior or brand new people. They typically know the HR folks better and have been involved in recruiting activities for a while so it is usually assumed that they have a good grasp of what types of candidates with which sets of qualifications the firm needs. But any referral is better than no referral.
Ideally, you get a referral from someone from the same office (or same country) you are applying to. But again, a referral from someone within the same firm but different country organization is still better than no referral.
A direct rejection after the CV screening stage can still happen - even with a referral. In that case the HR team usually provides some feedback to the person having given the referral. So you should follow up with them to better understand the rationale in case that happens. On the flipside, you can still get an interview invite when you just apply online without a referral - the probability is just lower on average, especially when your CV is not stellar.
And as always, factors such as economic conditions and headcount/budget planning of the individual firm also matter significantly in these decisions - but they are not within your control.
Best