BANGKOK — At a bend in a busy Bangkok road stands the Tree of 100 Corpses, a shrine to pedestrians who have died in traffic accidents nearby.

People come from all over Thailand to commune with spirits they believe reside in the tree, which is wrapped in golden cloth and surrounded by hundreds of figurines. They also come to find winning lottery numbers.

“I made a wish to the tree and asked that the number pop up in my dream,” said Kriengsak Konart, a motorcycle taxi driver who works in the area. The number 45 came to him in his sleep, he said, and he played a variation of it.

“I won,” he said.

The search for lottery numbers in Thailand can be confusing to outsiders. Many Thais believe that calamity can beget good fortune, and that tragedy may give rise to powerful ghosts who offer guidance on winning numbers. Newspapers report the license plate numbers of cars involved in gruesome accidents. Lottery aficionados note the highway route numbers where accidents took place, tally the casualties and play the numbers. Nothing is seen as too horrible to be a source of good luck, not plane crashes or massacres.