Adding page numbers to a master page in InDesign is a fairly straightforward process. First, you need to create the page numbering style. To do this, go to Type > Document Numbering and choose the style of page numbering you'd like. Once you've created the page numbering style, you can apply it to a master page.
To do this, double-click on the master page thumbnail in the Pages panel and the master page item will be highlighted in the main window. Then, go to Type > Insert Special Character > Markers > Current Page Number. This will place a marker on your master page that will automatically adjust the page number as you move through the document.
Finally, you will need to apply the page numbering style to the master page. Select the page number inserted on the master page and then choose the page numbering style you created in the Character Styles panel. This will apply the numbering style to the page number, and it should now be visible on all your document pages.