{output 'type'} sets $padOutputType for the rest of the request and loads that type's settings over the current ones. It decides how the whole response is delivered once the page has finished, not what happens at the place of the tag - so it can stand anywhere in the template. It does the same as $padOutputType set in _config/config.php or in the page's PHP, from the template.

The same JSON or CSV answer comes without the tag for ?page&padFormat=json (or csv) and for an Accept: application/json header - and then the template is not rendered at all. A page that exposes nothing has nothing to answer as JSON, and CSV needs an exposed list; both are errors.

A type that is not one of the six is an error, and the mode stays as it was. Because it changes the whole response, the examples here are shown but not run.