The point at which the float is placed in the source determines the placement of the float in the formatted document in the following way:
- The page on which this point in the source eventually appears in the formatted document will be the earliest page in the formatted document on which the float can appear. If the float is placed inside a paragraph, then this reference point is defined to be the next linebreak (compared to the actual placement in the source). If the float is placed between paragraphs then the reference point for the float is the end of the previous paragraph.
- It is possible (and in fact happens quite often) for the float to appear physically before this reference point but only through its placement in the top area of the same page.
- The moment LaTeX reaches the reference point in the source it will try hard to place the float as fast as possible, i.e., preferably on the same page.
The take-away from this that one normally should (at least initially) place a float close to its first main call-out, i.e., the place in the source where the float is referenced and one expects the reader to be interested in consulting the float material with ease. This is in most cases (but not always) the first reference to the float.
It is fairly easy to do this even within a paragraph, e.g.,
... some text. See figure~\ref{foo} ...
%
\begin{figure}
... \caption{..}\label{foo}
\end{figure}
%
... some more text in the same paragraph
However, even with the additional lines containing just a % this is somewhat difficult to read (and to maintain) and in most cases with minimal gain. So my advice is to initially place such floats always between paragraphs following the paragraph that contained the main call-out. When the document is in its final stage (with respect to its content). The float placement could then be adjusted if necessary.