Could this be Jitterbug Perfume by Tom Robbins?
As mentioned in the comments, which may be deleted someday, I found this by googling "pan king immortal dreams." Apart from the detail of the ending at Einstein's university, the Wikipedia page lines up with quite a few of the details.
And from the Kirkus Review of the same novel:
we follow King Alobar--a Dark Ages hero--through his global wanderings: he eventually reaches India, meeting a widow named Kudra; both of them are in flight from Death; and both eventually, through the direct intervention of the decrepit god Pan, actually achieve immortality--even learning how to capture the immortality-essence in bottled-liquid form.