How long is "long"? Under the current regulations, if you live outside the "Schengen" area, you can stay inside the Schengen area for 90 days then you must leave for another 90 days. 90 in - 90 out. Unless you find some special way via a special visa to circumvent that general rule.
About lodgings: We have successfully used www.housetrip.com for apartment rentals, but never for more than two weeks at the most. I'm not saying you won't find a property for a longer time, and you may even find a much better rate than the regular rates if you book for longer, we just haven't done that.
Google the terms "expats spain" and read the wealth of information that comes up. Much of it is geared towards Brits, many (TONS!) of whom you see retiring to small towns in Spain.
If you don't already find something by way of these means, you can consider doing a short-term rental in a place where you really would like to stay longer, and while you're there in your short-term rental, ask around. But you'd have to be sure you want to stay in that place, or nearby.