You don't mention what software you are using, but the general paradigm is that the header/footer definitions are attached to a "master page" style (aka page set). The master page also defines the width/height of the page and the number of columns and dimensions of the main text area.
Sometimes you need to have headers or footers contain variable content (such as page numbers or running header text). In that case the content of your header/footer must use some variable content "gentext" commands to generate the relevant content. For example a running header can find the first or last heading on each page and display it.