This is actually a good question that I have not been able to come up with a satisfactory answer for and depends on how far one wants to go in understanding the conversion process. Please feel free to correct me as what follows may be flawed:
The process, on a software level, involves the use of multiple conversion tables. which table gets used depends on what format the file is in to begin with and what format the file needs to wind up in. For example there is one table for pdf to epub and another for html to epub. What is a table? A spreadsheet with row A being individual characters in the input format and B is the characters in the output format. When a conversion is completed each individual character in the file is compared against the table, spreadsheet, and the oposite value is subsituted in the converted file. As the file to be converted gets longer so does the conversion process as each character needs to be converted one by one. Obviously computers are better at this an faster at it then humans are but it still takes a while. The dificulties come in when special characters such as !@#$% are used in the source file and sometimes do not have a corresponding value in the table. Other times there may not be a one to one conversion as the output format may not have a character corresponding to it, however this is rare.