How is a typical frontend request output generated?
Craft is an MVC application, so most requests initially will get routed to a controller action. Steps 3-6 in our Routing docs page show the various ways that the target controller action is decided.

Controller actions can really do whatever they want with the request at that point, but typically they will perform some level of authorization, and then either perform an action and/or define + send the response.

For example, if you request a template path directly, the request will get routed to the templates/render action, which will verify that the template actually exists, and then render and return it, otherwise throw a 404 exception.

Template rendering is ultimately performed by TemplatesService::render(), which is where Twig gets invoked.