Genjutsu (幻術, Literally meaning: Illusory Techniques) are techniques that are employed in the same fashion as ninjutsu, requiring chakra and hand seals. However, the primary difference between the two is that the effect of genjutsu is illusory, creating chakra imbalances in the victim's brain, causing a disruption in their senses. This is often used to create false images or cause pain from trauma (because the body is led to believe it is in pain), however there are plenty of other uses depending on the situation. They are not used as often as ninjutsu because they don't physically harm the opponent, but several characters have made themselves well known for their great prowess with genjutsu.
Genjutsu is created when a ninja extends their chakra flow through the cerebral nervous system of their opponent to control their mind's chakra, thereby affecting their five senses. Those with special abilities like the Uchiha clan's Sharingan or with high intelligence have an easier time executing and countering genjutsu, as attention to detail is key. Those under the influence of genjutsu either freeze in place or lose consciousness, depending on how capable they are in recognizing and defending against it.
To combat the effects of genjutsu, there are two options. The first option is for the ninja to stop the flow of chakra in their body, and then apply an even stronger power to disrupt the flow of the caster's chakra; this is called Genjutsu Cancel (幻術解, Genjutsu Kai). This can also be done by an unaffected ninja. The second option is through intense pain not caused by the genjutsu and utilizing the resulting pain to bring their senses back in order (of the two options, the latter seems more effective in most situations, or at least is the easiest). Genjutsu attacks usually will require a lot of skill, and if performed incorrectly will not work; even Jiraiya had trouble performing such techniques. Genjutsu is most often used by ninja with very precise chakra control and very high intelligence.
Although humans and dogs are affected by genjutsu, insects do not even notice it. This is because genjutsu attack the brain of the victim, which insects do not rely on much. As Shino puts it, insects are ruled almost solely by five powerful senses, which makes them immune to genjutsu and gives the Aburame clan an ability to detect it when nobody else can.