A shared doc — one you have published with a public link — can be read two ways by whoever opens it.
Human view
The default. The work as a person should read it — formatted, ordered, with the supporting material where you would expect it.
Agent view
The same page as the system sees it: the underlying structure and the content as it was actually stored.
Why you would switch
Agent view answers "why did it say that?" better than human view. When a figure looks wrong or a section seems to come from nowhere, it shows you what is actually there rather than what was rendered.
It is also what you want when driving the product through the API, since it corresponds to what the API returns.
Where it is
The toggle sits in the header of a shared page. It is not on the doc page inside the workspace — there, the doc page and Activity between them already show both what was rendered and what produced it.
See Sharing a doc.