The "Yetzer Hara" is the Hebrew word for the "evil inclination." Over time, there have been many opinions as to exactly WHAT it is, however all opinions agree WHAT it does. The function of the yetzer hara is to cause a Jew to sin, which means to transgress either Torah Law or Rabbinic Law.
The yetzer hara has been known to be one of the most clever entities to rule a person, and it is very smart the way it causes a person to sin. The yetzer hara fights for control over a Jew's will, and it seeks to influence the Jew to act against G-d's will at every opportunity that it can.
There is a parable that appropriately describes the Yetzer Hara. There once was a king who hired a harlot to test out his future son-in-law's loyalty and fidelity to his daughter. He told the harlot that her function is to work her hardest to cause the son-in-law to give into his desires with the harlot and to tempt him to participate in acts of infidelity with her. Both the king and the harlot both hoped and prayed that the future son-in-law would not give in to her temptress advances.
In the process of completing the king's instructions, the harlot was permitted to assign and she assigned her duties to another harlot with the instructions from the king to cause the son-in-law to give in to her advances. That harlot assigned her duties to another harlot with the same instructions, and so on. Eventually, the instructions were passed from one harlot to another, and eventually, the desire that the son-in-law resist the harlot's advances were lost. The only purpose of the harlot was to cause the son-in-law to indulge and give in to her advances.
In this parable, the king is G-d, the son-in-law is the Jew, and the harlot is the Yetzer Hara.
In truth, even the Yetzer Hara while tempting the Jew to sin by trying to get the Jew to violate one of G-d's commandments is serving G-d by doing His will.
The role of the Jew is to weaken the Yetzer Hara by not giving in to its temptations.
Further, the Yetzer Hara becomes stronger when a Jew indulges in activities, even permitted activities. Therefore, it is a practice for a Jew who is wishing to wage war with his Yetzer Hara [to weaken it] to obstain from activities that he finds that he or she is attracted to. The most common example when this concept is being taught is to abstain from indulging in a steak, or in ice cream, or in sexual acts with one's spouse, even though these activities are permitted.
Side Note: In Yeshiva, I used to find it so funny and yet disturbing that the Rabbis, when teaching us about not indulging in our sexual desires would use the example of not indulging in cake. Us bochurim (rabbinical students) used to joke around with each other and talk about what the reprocussions are for eating and for not eating the cake. In my opinion, there is no similarity between cake and a sexual desire. Chocolate is good, but not that good.