The programs that are capable of converting PDF files to JPG and other file formats literally translate the data that is encoded in PDF to render an equivalent in the file format of your choice. File converters use a list of rules to present the data using different syntaxes.
Conversion is possible because PDF files contain extremely detailed data about the composition and formatting of the document, including the positions and type of text, graphics, and other metadata that can be used as instructions for the converted file format.