The main force that changes Huck's attitude towards Jim are having repeated experiences with him that show Huck that Jim is a good friend, an intelligent man, and a person worth knowing and caring about. At the beginning of the novel, Huck thinks that Jim is just property, and, going along with what society has taught him, a stupid, ignorant, ungrateful slave that doesn't really have feelings. We see this attitude of Huck's through several instances where Huck plays dangerous and degrading pranks on Jim (the rattlesnake, the fog and dream scenario), and when he says things like "You can't learn a nigger to argue" when they are having conversations and Jim has the audacity to contradict Huck's "knowledge" on a subject.
As the story continues, Jim shows genuine friendship and affection for Huck. At one point, Huck is paddling off in the canoe to turn Jim in, but Jim goes on and on about how kind Huck is, and how he is "da bes' friend" a man could want--these kind words from Jim make Huck feel bad, and he doesn't turn him in. Jim helps Huck out several times, and seeing the world and how awful people are out there helps Huck to appreciate Jim more.
At the end of the story, Jim and Huck have been through an awful lot together. It is when Jim is sold by the duke and king that Huck realizes just how much Jim means to him. He starts to write a letter letting Miss Watson know where Jim is, but tears it up. He just can't let a good person like Jim go back to slavery. And, Huck is willing to stake his soul's salvation on helping Jim escape; he says, "I'll go to Hell then," thinking that helping a slave will condemn him. Huck now cares for Jim enough to risk his soul to help him. At the end of the story, when Jim offers to stay with Tom while Huck gets a doctor, Huck realizes that he "was white on the inside," showing how he feels that Jim is now his equal.
All of the experiences that they had together, a little taste of the real world, and Jim's kindness and friendship are all forces that played a role in Huck's changing attitude towards Jim. I hope that helps a bit; good luck!