The Rule is simple,if the kicking team touches the ball first it is considered "illegal touching". In that case the return team gets the option to either take the ball where it was first touched, or to take the end result of the play. The rule is to prevent the kicking team to intentally "tap" or "guide" the ball down the field in order to extend the punt.
Instance 1
The ball is bounced off the kicking team's leg at the 15, but downed at the 5. The ball would be placed at the 15, because it touched the kicking teams leg.
Another reason for this rule is to prevent the kicking team from intentially forcing a fumble.
Instance 2
The ball bounces over the head of the return man and the kicking team taps the ball off the guys back and then recovers the now loose ball. The return team retains possesion of the ball at the spot where the kicking team "tapped" the ball
Now of course the sidebar of this rule is that because the team has the option, once a member of the kicking team touches the football, the return team cannot lose so tospeak. No matter the end result of the play, they can always choose to return to the spot it was orginally touched if they didn't like the result.