I’m going to answer this from the opposite end: When is lying a good idea and why?

To save your life or the life of someone else, for obvious reasons.

In other words, in all other instances that I can think of, lying is a bad idea. The why is a much harder question to answer, because it varies so much from case to case. A universal answer is one @iamthemob gave: It’s easier to remember the truth. Some other answers might be: it hurts someone, if caught it causes a lack of trust, it creates a barrier between people that honesty doesn’t, and more.

NOTE: I am not saying people should be brutally honest. There’s pretty much always a way to tell the truth in a tactful way. If there isn’t, withhold the truth if you must, but don’t replace it with a lie.

The trouble with truth is—It hurts. It hurts to know the truth and it hurts to tell the truth. Telling a little white lie might keep us out of trouble for a while. It may save us embarrassment of not admitting to a mistake that we let others take the blame, so we can stay behind our shield and continue to project perfection.
Knowing the truth can also upset us. Learning things that were not as we believed can devastate us, taking away from our perspective of things that we thought to be real. The lie works both ways. We don’t like to be lied too.
It’s the old double standard I guess; we can dish it out but we can’t take it.
Guilt and a hurting conscious run rapid when we lie. As a child when I did something wrong I knew that I would be punished in some capacity. It those days, unfortunately, it was usually a whipping with a switch.
I lied telling my parents that I did not commit the act, what ever it was. Knowing that it might spare me a whipping if I could convince my parents that I was innocent, so I lied.
Everyone knows the story about George Washington cutting down the Cherry tree. This is a classic example of redemption. Confronted by his father if he cut the tree down, he says “I cannot tell a lie, yes I did.’’ His father did not punish him and acknowledge his courage to tell the truth.
In the children’s story of Pinocchio when his nose grew longer at every lie, we learned that the nose growing longer was a depiction of his guilt. In reality our nose does not actually grow longer, however our guilt does. When we tell the truth it can hurt because we have to admit to flaws and inconsistency in our selves.
As the years passed, we learned that deception and lying can only bring pain more than physical punishment. We also learned that telling the truth might lead to paying a consequence, but it well ultimately leads us to—peace of mind and a clear conscious.
In my life I have learned that lying is a terrible vice. That it can lead to other vices if it is left to grow, devouring all self respect. It is better to tell the truth, even if it leaves us with despair and hanging our head in shame.

For me, lying is like taking on debt. The more you do it, the more difficult it is to get yourself out of your situation. And you find that most of your work in life is spent trying to pay down interest. Eventually, you are essentially owned by the bank.

When you lie, you have the burden of the impending consequences to carry much longer, and then the added burden of being untrustworthy. I agree with @tom_g‘s analogy of taking on debt. If you did something, then owning up to it right from the start makes it easier to fix the consequences sooner.

Are you trying to not take responsibility for something you should, or get out of owning up to a mistake or purposely looking to hurt someone’s feelings, reputation or take something away from them with your words? Or are you babying someone who really needs to know the truth?

Lying is, by definition, deception.
Any lying that with holds or conceals the facts from another, falsely leading them into making, or not making, informed choices, based on factual reality, is wrong. Period.

So, any lying that involves manipulating anothers reality is grossly selfish, and harmful.

Lying can be a very important skill. For that matter, becoming a good thief can be important. I heard about a Native American tribe where boys had an “invisible” year. For a whole year, no one could “see” them. No one could feed them. No one could interact with them in any way. So the boys learned to steal—an important survival skill.

Lying can be an important survival skill, too. There are times where if you tell the truth, you’ll be killed. Or you could severely damage the lives of others.

Lying is a selfish thing to do. You hope to get away with something that benefits you without others finding out about it. Or you hope to get away with something that may hurt others if they knew. Like others have said, once you start lying, you have to keep on maintaining your story. That can cause a lot of stress.

When you are eventually found out, there will be hell to pay. No one will trust you again. They’ll always wonder if you are still lying. So whatever you’re lying about had better be worth those consequences.

@Hibernate I still don’t understand. How is this saving someone’s life? Are you imagining people chasing me and I’m hiding in your house? (Or not me, anyone, doesn’t matter…). You are saying that if your friend was being chances by the crazy ex-boyfriend of his wife and was hiding in your house you wouldn’t lie about where he is to save his life?