ItHow the insides works if a command exists: It's just usesuseing plain regular standard input to store the commands -either from script or not- and its arguments, then parses them so they can be sent to a system call like execve that will executefind the command in the system then run it:
http://man7.org/linux/man-pages/man2/execve.2.html
 Besides, like Time4Tea said, there's some builtin commands that are exclusive to the shell you're running. exit is one of them.
As a rule of thumb, if there's something about Linux you can't know by any regular means, just go for its source code.