"There were five bottles on the shelf."
Translation:Det stod fem flaskor på hyllan.
You can only say det stod about objects that are perceived to be standing up. Otherwise there isn't that much difference. fanns emphasizes the 'presence' slightly more and stod would probably be more neutral (at least for objects that are clearly standing), but the difference isn't huge.
It depends on the form of the shelf. If the shelf is seen as enclosing things, it will be in the shelf (i hyllan). Maybe a bookshelf with sides, for instance.
If the shelf is seen just as a flat surface, it will be on the shelf, på hyllan. This could be the case for one single shelf with no sides.