The three compilations with La(TeX) are needed to ensure proper links. The approach is illustrated in the following picture.
This is a source TeX/LaTeX/OtherTeX file that imports the style files tex4ht.sty and *.4ht. The style files define the features for the output.
The output of TeX is a standard dvi file interleaved with special instructions for the postprocessor tex4ht to use. The special instructions come from implicit and explicit requests made in the source file through commands of TeX4ht.
The utility tex4ht translates the dvi code into standard text, while obeying the requests it gets from the special instructions. The special instructions may request the creation of files, insertion of html code, filtering of pictures, and so forth.
In the extreme case that the source code contains no commands of TeX4ht, tex4ht gets pure dvi code and it outputs (almost) plain text with no hypertext elements in it.
The special (\special) instructions seeded in the dvi code are not understood by dvi processors other than those of TeX4ht.
This is a dvi file extracted from x.dvi, and it contains the pictures needed in the html files.
This is a log file listing the pictures of x.idv, the gif files that should be created, CSS information, and user directives introduced through the ‘\Needs{...}’ command.
This is an interpreter for executing the requests made in the x.lg script.