Using MigraDoc this is quite simple: your document has Headers and Footers. Add a Paragraph to the appropriate header or footer and call
Code:
par.AddPageField();
to add the current page number or call
Code:
par.AddNumPagesField();
to add the total page number.
You can even have different headers and footers for first page, even pages, and odd pages. Set the Primary header/footer to have one for all.
Headers and Footers belong to the section. Start a new section to change Headers and Footers within a document.