Huck endures Pap's abuse as long as he can, then realizes that he has to find a way of get away from him before Pap really hurts him, or worse. Huck tries to think of a way to get away and hide his trail so that Pap and the Widow Douglas aren't able to find him, but can't come up with an acceptable plan at first. However, after Pap becomes concerned that someone was trying to break into the cabin, Huck realizes that
what he had been saying give me the very idea I wanted. I says to myself, I can fix it now so nobody won't think of following me.
Huck went to great lengths to make it appear as though there had been a valiant fight, ended with a dead and bleeding body - probably Huck's since his hair was stuck on the bloody axe - had been dragged through the woods and thrown into the river. He wanted to do everything possible to convince anyone who cared to search for him that his body was lost in the river so they wouldn't continue searching for long. Then he could finally be left to live life as he wished.