The mechanism starts with the way in which you've configured the GTM. I take it you have inherited this from someone else and didn't do the config yourself?
GTM starts with the wideIP. Maybe not an intuitive name. It's the DNS FQDN you're requesting. That wideIP have a number of pools associated with it and a method of balancing across those pools. Each pool is then configured with virtual servers (Which can be BigIP VS's on an LTM somewhere or a remote apache, asterix, or whatever service endpoint).
The exact method of config across pools, and within are up to you (Or whoever configured it).
When you have 2x GTM's they should be configured to share their info using GTM sync. GTM also monitors the VS endpoints. With LTM that's usually via the BigIP monitor that uses the big3d daemon. The lTM's report the status of VS to GTM. GTM notes whether the VS's are up or down and uses the VS status along with the configured method and any GTM iRules to decide which of the configured VS's to return as the GTM wideIP.
There's also the possibility of LTM iRules being involved on the VS that is used for the GTM listener.
The GTM IS a DNS server. Albeit a slightly more configurable one than your standard bind server.
That's pretty much it in a very small nutshell. In reality it'll be slightly more complex. Any chance you could clarify which part of the mechanism you mean in your question? We could expand a bit on the details then.
H