Lord Valentine's Castle by Robert Silverberg. One of the best fantasy books I've read.
https://books.google.dk/books/about/Lord_Valentine_s_Castle.html?id=Rlwq3zuI4nQC&redir_esc=y&hl=da
Set in an immense world teeming with alien races and fantastic, almost magical, machinery, Valentine, an itinerant juggler, wakes up one morning with only a vague and troubled idea of who he is. He gradually discovers, through dreams and portents, that he is in fact his namesake: Lord Valentine, the Coronal, his body and throne stolen by a usurper.
https://books.google.dk/books/about/Lord_Valentine_s_Castle.html?id=Rlwq3zuI4nQC&redir_esc=y&hl=da