In more detail
A PDF starts with %PDF- and ends with %%EOF, with a cross-reference table that lets a reader jump to any page. Merging joins the page lists of several files, splitting extracts a range, reordering rearranges pages and numbering stamps a number on each.