Mark Twain strove to make the characters in The Adventures of Huckleberry Finn real people who would be very recognizable by those who read his novel. The superstitions held to be truth by the characters reflected the beliefs and educational levels of those characters and of their real-life equals.
Many superstitious beliefs develop from an everyday event that is exaggerated as it is retold. Spiders would not have bothered a nature-lover like Huck. When Huck brushed a spider off his shoulder and it landed in a candle flame and burned, he truly believed that his killing of that harmless animal would result in something terrible. He follows the rituals to try to prevent the bad luck, but doesn't have much hope for their impact.
I got up and turned around in my tracks three times and crossed my breast every time; and then I tied up a little lock of my hair with a thread to keep witches away. But I hadn't no confidence.
Slaves used superstitions to attempt to make sense of their world, to provide explanations for things they couldn't understand or control and had no education to explain. When Jim acquired the hair-ball from the ox's stomach, this unusual item was assumed to have special powers because of its rarity. After Huck provided the money the hair-ball needed to talk, it told Huck's fortune to Jim.
Of course, the prediction is so vague and full of contrasts that it could be interpreted to accurately predict any outcome or future event. However, Jim's telling of the fortune included the comment that "You gwyne to have considable trouble in yo' life." When Huck discovered his Pa waiting for him in his room, he naturally thought of that prediction and considered that the hair-ball had been absolutely right.