If you need to personalize or A/B test the Header and Footer (or any other global presentation detail, than they cannot be statically rendered to the page.
In other words you cannot do:
You must apply a placeholder that applies the navigation or global elements to the page, so that they can be personalized. This is also known as
Dynamic Renderings and is at the core of being able to use datasources and using different mechanisms to change the datasource based on conditions.
Typically that would also mean that now you would have to have this navigation applied to every page item of your site. There are a couple of options you have to help reduce the amount of effort that this would require.
You could define a Base Template that includes information about the placement in Presentation Details in the Standard Values, and then apply that template to all of your Templates that would need it. I'm not sure that would work too beautifully if this is a change you are making. That works better if it's a new build out.
Second option is that you could build something similar to SxA's feature
Partial Designs that would basically be a way to define a grouping of presentation details and include that on a page. All modifications would happen on the grouping, and the pages would just inherit the changes you make to the grouping or partial design.