We've talked about Induction and Deduction before, which are two varieties of logic. It's useful to discuss logic in the widest sense.
Rand defines logic as "the art of non-contradictory identification". The just means that logic is concerned with eliminating contradictions. A contradiction is when two things can't both be correct at the same time. In reality, if something can't happen, it doesn't. But in the world of ideas, you may be mistaken about what can or can't happen, as well as whether they actually did happen.
When you try to understand something, one of the key criteria to use is that the statement doesn't contradict the rest of your knowledge. If it does, you have a problem and need to look further. In reality, there are no contradictions. So for your knowledge to properly reflect reality, it cannot contradict itself.
Logic is often seen in the form of logical deductions. Deductive syllogisms are true because if they were not, there would be a contradiction. If "All men are mortal" and "Socrates is a man", then Socrates must be mortal. If he were not mortal, the conclusions would contradict the premises. Non-contradiction is the essence of deductive logic. The rest of the rules of logic are all derivative of this one central premise.
There are entire books written on the topic, so I won't go into too much detail except to point out a few things to get you thinking in the right way.
First, you use logic all the time. Every act of identification and integration requires you to look for contradictions. Imagine trying to integrate information that contradicted itself. If a man saw his wife at a restaurant with another man, and then later she told him that she stayed home all day, how would he integrate the knowledge? He can't accept both as valid. If he did, it would imply that she can be at two places at once, and destroy all kinds of other knowledge. He can say that he believes both to be true, but the contradiction will act like a roadblock in his mind. It prevents integration from happening. It keeps the ideas disjoint. To resolve the contradiction, he would need to identify the contradiction, and check his premises. He'd have to figure out which is not true.
Sometimes when trying to understand a concept, contradictions are accepted. Obviously that's not likely at the perceptual level where your getting your data from reality itself. But higher level concepts can have contradictory elements. Communism, a system of control through force, was often said to be peace loving. Family is often thought of as requiring love amongst the members, and yet it's also known that family members know how to push your buttons. There are all kinds of ways you can mis-integrate due to contradictions. For a concept, you try to identify the key properties common to all of the referents for the sake of defining it and understanding it more clearly. But these properties may be contradictory, as the examples show. This could result in a few things. First, you may mean two different things when you use the word, and the fact that they're not compatible is blurred by using the same name and having some similarities. That means you'll end up equivocating between them, which just means you go back and forth between the two concepts. A second kind of problem is that by trying to integrate things that shouldn't be integrated, or at least not with along the lines you're attempting to, your final understanding of the concept might be blurred. You'll have an approximate understanding of what you're talking about, but not really. Any further knowledge you base on this self-contradictory concept will also suffer from the same flaws.
Another point worth bringing up is the relationship between logic and objectivity. Logic is concerned with not having contradictions. In this abstract sense, people can make their own belief systems logical, in the sense that the different ideas don't contradict with one another. But that's worthless unless the ideas are true. And that's why objectivity is so crucial. Everything must be aimed at grasping reality, as in the real world. Constructing clean but incorrect ideas of how the world works won't do you any good. Logic divorced from objectivity is pointless. It's only because we're trying to grasp reality that logic is necessary. If your ideas are divorced from reality, then the reason to be logical stops being valid.
Logic extends not just to our abstract ideas, but to the evidence of the senses. You use logic in evaluating the data your receive from the outside world. Logic is concerned with making sure your evaluations of that data conform to what you know about reality already. If your ideas contradict what you see around you, there's a problem.
Logic can show whether there is a contradiction, but it doesn't say which element is incorrect. In fact, both may be. To solve that, you have to check your premises, look to reality for more evidence, and otherwise investigate.