If a person is thinking of taking legal action, if they consult with a lawyer do lawyers ever advise "your chances of winning are so low you shouldn't bother pursuing this"? On one hand it may be good advice, but wouldn't that be counter productive to the lawyers business? Presumably the lawyers want a client so can it be a conflict of interest? Can it somehow be guarded against?
Yes lawyers do this. quite often in fact.
There are professional and publicity reasons of course, that should suffice to not give bad advice and harm your career.
But there is also a legal reason. Lawyers are responsible for the advice they give (as most professionals). If they give bad advice, they may be liable for damages!
do lawyers ever advise "your chances of winning are so low you shouldn't bother pursuing this"?
Yes, it happens. But the frequency with which that happens should not lead to the presumption that people in general are exempt from fraud by their own lawyer.
Many, many lawyers take cases despite knowing those are devoid of legal merit. Some of these lawyers end up in a list of vexatious litigants, like this list from Texas courts. Although such lists primarily reflect the attorneys' hindrance to the court system, these also suggests that their clients' bills are inflated as a result of lawyer's vexatious acts.
Furthermore, lists of vexatious litigants cannot capture all the forms in which clients might become victims of lawyers' greed. For instance, this report denounces attorneys' habit to drag cases for as long as it takes them to deplete their clients' savings.
Can it somehow be guarded against?
Yes, through knowledge, most of which is available online, in people's own language, and for free. Unfortunately people underestimate the importance of acquainting themselves with legal concepts before they consult an attorney.
Without an elementary background in law, the potential client is more susceptible to intimidation by a lawyer's incomprehensible words (be it that the lawyer deliberately speaks too fast, uses needlessly sophisticated terms, etc.), more vulnerable to the lawyer's misleading oversimplification of the client's matter, or unable to discern that the lawyer's answers are too ambiguous or evasive.
Most legal work is not dispute resolution
Sure, there are specialist litigators (called barristers in common-law jurisdictions outside the US) but most legal work is conveyancing, wills & probate, estate planning, businesses structure, contract drafting and advice, family law, criminal law and telling you why civil litigation is a bad idea.
Most dispute resolution is not litigation
99.99% of disputes are resolved by a negotiated compromise or by one party putting up with the status quo. Most of the rest are resolved by a) kicking it up the chain of command until the compromise happens b) alternative dispute resolution in the form of mediation, conciliation, expert determination or arbitration or c) taking litigation to the steps of the courthouse and then settling.
Only people with more principle than brains goes through to litigation.
If a man stopped me in the street and demanded of me my watch, I should refuse to give it to him. If he threatened to take it by force, I feel I should, though not a fighting man, do my best to protect it. If, on the other hand, he should assert his intention of trying to obtain it by means of an action in any court of law, I should take it out of my pocket and hand it to him, and think I had got off cheaply.
A lawyer should tell you what you legal rights (probably) are
They cannot tell you if they are worth pursuing or defending because that’s a commercial and emotional decision - not a legal one.
They can also be wrong - not a criticism: so can your accountant, engineer or plumber. However, your lawyer is often dealing with more ambiguity.
A wants B to pay him some money, B refuses. A goes to a lawyer, wanting to take the matter to court.
The lawyer should have some idea what are the chances of winning, what is the cost, what you would expect to gain, and importantly what are your chances to get money at lower cost. For example, a convincing letter from the lawyer might change B’s mind at much lower cost.
So if it is better overall to not go to court, a good lawyer will recommend to take no legal action. If the lawyer thinks the action is vexatious they may even refuse to take the case. And you can go against the lawyers advice. If you hate B, and you don’t mind to pay $1000 to make B pay $200, your lawyer will likely do it.