This form of ESP is called Psychometry, i.e. “a form of extra-sensory perception characterized by the claimed ability to make relevant associations from an object of unknown history by making physical contact with that object.”
Psychometry is a form of Retrocognition, or Postcognition, i.e. past tense information, or retrocognitive clairsensing/clairvoyance; involving visual, auditory, olfactory, and possibly gustatory, if not more sensory modalities, that are received via clairsensing/clairvoyant processes.
Basically, the supposition is, that all objects “contain” information regarding their history, events, states, etc., including the information textually written within them. Experients of psychometry can touch a book, or quickly flip through the pages of a book at incredible speed and clairvoyantly (clairvoyant cognition) receive the summation of the book, either directly from the book, or indirectly through Nature.
Other psychics, such as Edgar Cayce, have reported the ability to “absorb” information from a book placed under their head while asleep. How this process works for sure is unknown. However, some assume this is the result of energy transference, or quantum correlations i.e. a “quantum connection,” be they the result of entanglement or non-classical correlations void of entanglement.
The topics mentioned above are topics of parapsychology. Therefore, if one desires to know more about how such abilities work, they should look into books or journals that involve the scientific study of psi.