A defense attorney has an important job. He or she is on your side, knows the law and knows what it takes to win your case. In the event that the case isn't able to be won, your attorney knows other alternatives to facing serious penalties, which makes it easier for you to get a plea deal or to fight for a lesser penalty.
The defense attorney first has to assess the case. He or she looks at it from all angles to determine if there is a chance to win the case or if there is a better alternative. The attorney has to know all aspects of the case to make sure that he or she is familiar with the client's side of the story as well as what the prosecution is alleging. The attorney needs to be familiar with all the evidence in the case as well as possible witnesses or other claims that might come up.
Your defense attorney also receives plea deal offers that he or she can then tell you about. He or she will have information on whether or not the plea is a good deal based on past cases and your particular situation. If so, he or she may advise you to take the plea, whereas if it's not good, he or she may advise you not to take the plea and to wait for a better offer or until the trial to have the court hear your case.
No matter what happens in your case, it is up to you as to whether or not you decide to accept a plea deal.
Source: Chron, "Role of the Defense Attorney," Beverly Bird, accessed Nov. 02, 2017