I'm happy to go away and read the User Guide to learn how to do this but I've not attempted it before and wanted to benefit from the experience of others. Can it be done? Do I start by making a book file? Not done either of these things before (or for a long long time if I did!).
Yes, you should go over the help files, but I can give you the bullet points.
You apply one or more paragraph styles to certain bits of text in your document, and designate those styles as part of the TOC. When you build the TOC, anything styled with those paragraph styles will be copied to the TOC. You can decide if you want a page number, whether it is before or after the TOC entry, and how the two will be separated (like with a leader). You may have a paragraph style applied to the TOC, and if you are using a book, all entries from all chapters will be included if that's what you choose. There are more options, so I suggest you check the help files, and if you need more info, Sandee Cohen's book has been recommended on this forum many times. There is also Lynda dot com, where you can subscribe to training videos, or see if YouTube has any that help.
And a warning:
Keep the Table Of Contents in its own story.
Do not thread the story of the TOC to another story.
Otherwise: Updating the TOC will remove all text that is related to the threaded story.