The main character explores a castle that fell out of the sky. It was discovered that it was supposed to fly through the sky using magic but something happened and it crashed. It fell prior to the start of the story. I cannot remember why he was exploring it. I think there was a part where he found the remains of the mage who was responsible for it flying previously. I do not remember if he died during the crash or if his death caused it to crash. The main character somehow restored to magic of the castle to get it flying again but I am vague on how.
Lawrence Watt-Evans's With a Single Spell (1987), second book of his Ethshar series.
A SINGLE SPELL
Tobas had been lucky to find a wizard to take him on as apprentice. But then the wizard died suddenly and unexpectedly after teaching Tobas only a solitary spell, and the youth was too old to find a new master. How could he earn a living when all the magic he could do was light fires?
A DESTINY UNFOLDING
In the Small Kingdoms there were dragons to be slain, princesses and gold to be won, magic castles, witches who knew the secret of immortality, and other treasures. But how could a wizard with a single, simple spell hope to find them and win them?
Tobas does find the formerly flying castle, with the skeleton of its dead Wizard master, who had been the victim of an anti-magic zone during a past war. By accident, he travels through a magic tapestry to the Wizard's actual sanctum, after taking it outside of the anti-magic area. Within, he find the eternally youthful wife of the Wizard, who has been trapped for around a century, with the return tapestry not working.