Jackastor has it covered.
With a factory reset, you lose everything. But, any kepubs you have purchased will be downloaded again. And any that you are reading will get their reading position set to the last time you did a sync. Same goes for bookmarks and annotations for these books. Shelves will be recreated and the kepubs put back onto them.
Nothing about sideloaded books is synced automatically. If you use calibre, it can recreate the shelves and shelf status of the books. And the
Kobo Utilities plugin can store the reading status of the sideloaded book in your calibre library and restore them later. It also allows you to backup the annotation files created for epubs but doesn't do anything for annotations for other formats.