ANSWER: The tradition of casting lots is in the Bible several times. They are thought to have been used in 1Samuel 14:40 - 42. In this case, however, it is not lots that were cast but rather the Urim and Thummim used to render a decision.
The Urim and Thummim were only cast by the High Priest. According to the first century Jewish historian Josephus, the Urim was composed of two sardonyx stones, each one within a pouch in the Breastplate worn by the High Priest. This breastplate is known as the breastplate of judgment. That said, the practice of casting lots was used frequently in ancient Israel.
The primary reason for casting lots was to render an impartial, unbiased decision on important matters. Once they were cast, no one could argue that the decision was the result of human intervention like nepotism, politics, favoritism, and so on. This practice would be the same as throwing dice or flipping a coin we commonly use today. In ancient times, they used varying means to cast lots, depending on the place and local customs, such as coins, polished sticks, cards, dice, and so on.
What is particularly significant is the fact that, in ancient Israel, the High Priest did use from time to time the tradition of casting lots for important, uncertain decisions. It amounted to consulting God for the answer, as Proverbs states "The lot is cast into the lap, but its every decision is from the Lord" (Proverbs 16:33).
This impartial practice stops arguments and contentions between people (and no doubt could prevent them from occurring in the first place). The book of Proverbs states that "Casting lots causes contentions to cease, and keeps the mighty apart" (Proverbs 18:18).
The last written case in the Bible of casting a lot is in Acts chapter 1, when the apostles asked for God's decision regarding the choice between two men to replace Judas.
26 Then they drew lots (other translations have 'cast lots') to choose between the two men, and the one chosen was Matthias . . . (Acts 1:26)
It has been an ancient practice for people to take upon themselves to inquire about things unknown through mediums, readers of cards, palm readers and so on. God condemns, as made abundantly clear in Deuteronomy 18, these occult practices. There is nothing wrong, however, with a modern version of casting lots like flipping a coin to select something or determine a winner. When done, however, it is important to remember that chance produces the outcome.