There is no 'One True Way' to do these things, everyone finds their own favourite method in the end.
If you're starting with a clean HTML file, my preferred method is to open it in a text editor and make sure that each chapter is marked up with suitable HTML heading tags.
For instance, for a book with a single level TOC
Code:
<h2>Chapter 1</h2>
...
<h2>Chapter 2</h2>
... ...
Once you've done that you can reimport the HTML file into Calibre and convert to EPUB paying particular attention to the StructureDetection page. The 'Detect chapters at' box can be set to
//h:h2
The resulting EPUB will have a TOC entry wherever you put the <h2>...</h2> tags.
If your book needs a 2-level nested TOC, e.g. with Parts and Chapters, then you can try marking them
Code:
<h2>Part 1</h2>
<h3>Chapter 1</h3>
...
<h3>Chapter 2</h3>
... ...
<h2>Part 2</h2>
<h3>Chapter 3</h3>
...
<h3>Chapter 4</h3>
... ...
When you convert to EPUB the StructureDetection page should have the 'Detect chapters at' box set to
//*[name()='h2' or name()='h3']
and on the TOC page set
'Level 1 TOC' box to //h:h2
'Level 2 TOC' box to //h:h3
The converted EPUB will have TOC entries for each item where you used either <h2>...</h2> or<h3>...</h3> tags. Each <h3> item will be nested inside the previous <h2> item, like the attached pic.