In my experience, kids most often lie because there is an immediate pay-off for lying or they think there's one.
By payoffs I mean rewards or avoidance of real or perceived negative consequences. For example, A child may lie if a parent asks who "spilled this milk everywhere"? They may lie to avoid being punished.
If a child is playing a video game and is only allowed 20 minutes after homework, and a parent asks: "Are your 20 minutes nearly up?" A child whose already played for half an hour may lie and say: "No" because the short term pay off is continuing to play the video game.
As a child gets older, ideas about negative and positive consequences (right and wrong) come into play more and more) in keeping with what their parents, peers teach them. So, the motives for lying can become more abstract. But there are often negative and positive learning experiences that support those values and choices.
Yet many people are surprised to learn about how big a role immediate negative and positive consequences play in shaping and maintaining, in even the most complex adult behavior choices and emotional experiences.