I'd definitely buy rather than hire, and as Corned Beef points out, Decathlon stores en route (Porto, Vigo) provide good service. Decathlon will also sell you racks, locks and panniers etc.
Selling in Santiago is best on Idealista, the Spanish buy and sell app. Dealers will give you less than the bike is worth.
If you go for an ebike, Decathlon has the excellent Rockrider EST 100, about 1,000 euro and easily saleable for at least 750 in Santiago. I've cycled Lisbon to Santiago a few times on an ST520 hybrid and it's easy, fun and no real problem as long as you wear day-glo, keep right and use a mirror. Spain is excellent, with wide margins and polite drivers. The coastal route Porto to Lisbon is bike heaven, flat, boardwalks by the sea.
If you get fed up cycling, Portuguese and Spanish medium-distance trains accept bikes.
Have fun, but it'll be hard not to