The value of a secondhand book (and most "rare" books are secondhand) is essentially determined by the interaction of the forces of supply and demand. If supply is small and demand is high, value will be more than if the reverse is the case. Naturally we can then ask "Well what determines the demand for a book and what determines the supply?"
The main factors influencing the demand for rare and collectible books are the tastes and preferences of readers and collectors, their numbers, their disposable incomes and their expectations of the future. A change in these factors will lead to a shift in demand upwards or downwards for a particular title, author or subject. Supply in turn is influenced by technology (eg; online listings have led to a shift upwards), the number of sellers and their expectations of the future.
In conclusion, just because a book is in very short supply (ie rare, scarce, uncommon) it does not follow that it will be valuable as the demand (ie want, desire, requirement) for it, may not exist at all.