Functions calling mechanism under the hood

I wanted to learn about how are functions indexed under the hood . Also how is the model programmed to-

  1. understand what functions are available
  2. Reference to an available function and return output

Basically curious to have a deeper understanding on what happens under the hood?