The best way of knowing if someone is lying to is by having spent a great deal of time with them so that you know their "telltale signs".
In other instances you ask a question and there is a pregnant pause before they give you an answer, or they ask you why you're asking... to stall until they can come up with something.
Some people show a sheepish grin or do a nervous laughter before composing themselves while others act insulted, angry, or defensive because you asked the question.
Others avoid direct eye contact or they physically seem "uncomfortable" and start to move around the room (as if going to get something) while talking to you.
Note: Some people are aware of the "avoiding eye contact" sign so they will do the opposite by staring into your eyes (without blinking). Essentially they're overcompensating!
Sometimes people will give you a "quick answer" and then attempt to pivot off of the subject by bringing up a "new topic" or asking you about something completely unrelated.
I once saw a movie where a male character got busted for cheating on his girlfriend.
He said: "I lie to you because I care about your feelings!"
I suspect one of the motives why people lie is because they don't want others to think about them a certain way or they fear they wouldn't be liked or loved if people knew the truth.
More often than not people like impress others/get ahead or to avoid pain/punishment.
Never (force yourself) to trust anyone. The onus is on them to (earn) your trust!
If something doesn't (feel) "right" to you it's probably not right for (you). Don't ignore "red flags" or your gut instincts.