Postscript is a language, where a document begins with page definition like "letter", which defines defines a setpagedevice and initgraphics... which initializes a new page and ends with a "showpage" which sends the raster image to the printer. To produce an n-up page, the beginning and ending commands need to be redefined to not initialize a new page and not output the page, but instead define a series of commands which will scale and position the individual pages into a super page.
If all of the pages come from the same source, it isn't too hard, but if the ages come from a variety of sources and goes to a variety of output devices it can get difficult quickly. If you want to mix pages from multiple sources on the same page can be extremely difficult.
A term you can search on google is "imposition".