Rendering the layout happens if context.layout_name is set after the controllers and views execution (the view is optional).
context.layout_name
Since layouts are views, the execution and rendering for layouts is the same as for views.