The best merchants I found for spell books were Kistandalius or (less often) Blake in Ars Magicana and Corinna or (less often) Mpenzak in Verdistis. There is a small chance any NPC (or bookcase) will have a spell book.
If you quick save before running your mouse over an item/chest/merchant or hitting the alt key, you can identify the item or trade with the merchant, then quick load to get different stats or inventory. This can be done repeatedly to get the best stats or specific bonuses on an item (save after finding good candidates) or looking for specific items (such as spell books or charms) from merchants. Don't waste too much time with this, though, it really isn't necessary to get the best possible equipment.
Free skills, and spell books you can buy