How does the mechanism for floats work internally in LaTeX (or are they TeX? as someone who never really learned TeX without LaTeX, I have no idea)? I understand how to produce them and that sort of thing, but I'd like to understand how the content in the float actually gets moved to later in the document. For example, do the macros in a float environment get evaluated immediately or somehow delayed. If they are evaluated immediately, how do they end up further down in the final document. If they are evaluated later, how does LaTeX know the size that is needed for the float?
Sorry if this question has already been asked/answered somewhere; I spent quite a while looking and only turned up things about how to change behavior of floats, rather than explanations of how they work.
\savebox
all macros are resolved at the point the environment is met and the content typeset into a box register.