In the old days, books went out of print shortly after it stopped being profitable for the publisher to print new runs. My understanding is that good contracts had clauses that caused the rights to the book to revert to the author once it had been out of print for a certain length of time.
Nowadays, e-books seem to be a standard part of contracts. E-books essentially put all the publisher's costs up-front, and make it very inexpensive to keep the electronic version of a book in print indefinitely.
Does this allow publishers to keep books "in print" forever and prevent the rights from reverting to the author, even when the book isn't selling? Is it common for modern contracts to include language that allows the rights to revert if sales drop below a certain threshold?