The practice requires a book already regarded as authoritative, and the history of it is largely a history of which book a culture would trust that far.
In the classical world it was Homer and then Virgil, and the Latin name for the practice preserves the second. In Christian use the Bible replaced them, and the sortes sanctorum were condemned by church councils on multiple occasions across several centuries, which is reliable evidence that they went on being used. The most celebrated instance in Western literature is Augustine's own account of his conversion, in which he hears a child's voice telling him to take up and read, opens the letters of Paul at random and takes the passage he finds as addressed to him.
Islamic practice has its own forms, including consultation of the Qur'an, and in the Persian world the poems of Hafez are used for the same purpose in a living tradition with its own occasions and etiquette. The book chosen is a poet rather than a scripture, which changes the theology without changing the method.
The mechanism the practice depends on is not obscure. A rich, allusive text opened at random will supply something that can be read as pertinent, and a reader with a pressing question will do the reading. What the tradition adds is the discipline of accepting the passage found rather than turning the page for a better one.
That constraint is what distinguishes it from simply consulting a book.