I reference a node into a view header (rendered entity). I need to do some changes in the output of this referenced entity.
Does anyone know the filename for the needed template?
When an entity is rendered an entity view mode is picked. Each entity view mode can have different dispaly configuration. So, you may add a new View mode to your entity and set up the appropiate display config in the entity display page.
Then, in your view, seleect this view mode when configuring the rendered entity.
If you need further output customization you can define your own template for your View mode.
To add anew view mode you can check this question: How to add additional display(view mode) for node?
To set up a template file for your custom VIewmod you can check this question: How to provide template for particular view mode?
You can also use the full view mode, but this affect all rendered entities of this type.