If a stun gun was used, who is to say that he used it on her in her room. He simply could have picked her up and carried her while she slept all the way to the basement stairs. Maybe as he was making his way down the final stairs to the basement the child woke up while he had her in his arms and maybe he had to hit her with the stun gun with one hand while cradling her in his other arm against his body. The jolt of the stun gun could have caused him to partially drop her and she hit her head hard on something while he was trying to catch her before she hit the floor. (yeah I know... it seems wild, but you have a big house here with parents and a brother who probably sleep like a rock.)
Bear in mind that a total stranger would not know the sleeping habits of the Ramseys. He wouldn't even know if the parents were asleep or not, because they were on the upper floor. Every single minute a stranger remained in that house was a minute when he potentially could have been discovered. If the perp were a stranger, simple human nature and logic dictates that he would have wanted to get out of that house as fast as possible, with or without a successful snatch of the girl.
Everything we know about the case suggests the killer was not afraid of being caught that night.