How far are priests and other religious allowed to go in terms of political endorsements (or non-endorsements)?
First of all, what generally applies to bishops, will apply to priests and Catholic Religious.
There is a way to preach sermon that do so as to be able to instruct the faithful on both faith and morals in this area in such a way that the sermon remains non-partisan and simply present political statements on a moral basis. A good preacher need not to name parties or individuals, but after informing the faithful how to vote in an objective manner with their own freedom to do so according to their proper conscience and insight.
The following article, although for issues in Canada can be of much insight for other countries too.
The Church in any particular country would have carefully tread in political sermons in order to avoid losing their tax exemption status from various governments also.
Considering clergy in general, political activity is not their responsibility, but that of the laity. Consistent with this, Canon Law not only commands clergy to acknowledge and promote the mission of the laity in the world, but forbids clergy to assume public office. Granted: clerics may, with the permission of their superiors, play an active role in political parties or trade unions in order to defend the rights of the Church or to promote the common good. However, this kind of activity is clearly exceptional, justified only when the laity is unable to act effectively without direct clerical assistance. Such circumstances have existed and continue to exist from time to time in different places, but they do not now exist in Canada.
Bishops do not exceed their authority or competence simply by commenting upon political issues. Faith and morals are a bishop’s proper and primary concern. But marriage, divorce, pornography, abortion and euthanasia are all moral issues which are the subject of intense political debate; so is the just distribution of earthly goods. The Church has not only the right but the duty “to pass moral judgements even in matters relating to politics whenever the fundamental rights of man or the salvation of souls requires it.”
Neither of these concepts can be narrowly defined. Among the fundamental rights which popes and bishops have defended, for example, one finds private property, life, health, religious freedom, the right to form unions, the right to a just wage and decent hours of work, and the right to be free of excessive taxation.
The goal is to help shape public policy that is in conformity with the law rooted in our nature that governs us all no matter what our religious belief. Thus, politicians are called to try an ensure that the laws that govern us protect human life, respect the human person, preserve the unique nature of marriage, support family, ensure the safety of children, guarantee religious freedom and make it possible for all citizens to share in the conditions that are necessary for humane living.
In arguing for such things, bishops attempt to clearly enunciate general principles concerning the purpose and use of created things,10 peace, war, the just distribution of material goods and the “fraternal coexistence of all peoples.” They may also, “after mature reflection and with the help of qualified persons,”pass judgement on the morality of secular works or institutions, and explain what is needed to safeguard and promote transcendent moral and religious principles. Bishops may do this well or do it badly, but they do not “interfere” in politics by doing it.
The relationship of bishops with politicians who identify themselves as Catholics begins with three assumptions: the truth of Catholic teaching, the inseparability of faith and life and the sincerity and integrity of the politicians.
If Catholic politicians support policies and laws that seriously contradict Catholic teaching, bishops, led by charity, will assume that the politicians? views are the result of ignorance or poor instruction. Since it is reasonable to believe that sincere Catholics would not wish to remain in error about Catholic teaching, it is reasonable for bishops to attempt to correct them. - The Clergy and Politics
The faithful have the right to be instructed in order to make a moral and informed decision about voting. A good sermon would give the Catholic principles for discerning how to vote without pronouncing a sermon without a particularly partisan aspect to it. It is an art that seem to be hard to achieve by many of the Catholic clergy.
Catholic pastors must educate the people of God in political matters so that informed decisions in the political field in regards to the Christian principles of the Catholic Church.
Priests are also encouraged to vote according to their informed consciences.
Catholic clergy are forbidden to hold a political office. This is backed up in Canon Law.
Can. 286 Clerics are prohibited from conducting business or trade personally or through others, for their own advantage or that of others, except with the permission of legitimate ecclesiastical authority.
Can. 287 §1. Most especially, clerics are always to foster the peace and harmony based on justice which are to be observed among people.
§2. They are not to have an active part in political parties and in governing labor unions unless, in the judgment of competent ecclesiastical authority, the protection of the rights of the Church or the promotion of the common good requires it.
Can. 288 The prescripts of cann. ⇒ 284, ⇒ 285, §§3 and 4, ⇒ 286, and ⇒ 287, §2 do not bind permanent deacons unless particular law establishes otherwise.
For further insights, I would encourage the reading of the following articles: