Lord Valentine's Castle by Robert Silverberg
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.
Across the giant world of Majipoor, Valentine sets out on a quest to win back his throne - and discover which of his enemies has the power to vanquish him so utterly from not just his throne, but his very life . . .