Neither really, the Routines run in the ST cloud and the hub is not involved at all.
My understanding is that the ST app uses the location services provided by the phone OS to set up a geofence. The app is alerted by the OS when the device enters or leaves that geofence and communicates that to the SmartThings cloud.
Originally that would have resulted in a Groovy Device Handler being called and that would have set the presence attribute of the presenceSensor capability appropriately. It now uses a ‘mobile connected’ integration which is not really documented but has the same end result.
The bottom line is that the OS has to be able to detect the device crossing into and out of the geofence and the app has to communicate that to the ST cloud.
Where does it go wrong? I can only speculate on this, but the impression I get is that it is something of a one shot thing. So, for example, if you don’t have a data connection when it is needed there might not be another try. And that’s if everything else is working properly.
Sometimes things don’t work properly. For example, if the OS has put your app to sleep, or worse, then the app won’t be listening when it needs to.
I don’t know if it still happens, but it certainly used to be the case that not all phones could use data while on a call. So that was another potential problem.