Avot 1:7 Nittai of Arbel says: Distance yourself from a bad neighbor; do not associate with a wicked person; and do not despair of [or abandon belief in] retribution.
Distance yourself from a bad neighbor…
Yehoshua ben Perach’yah advised us to judge everyone favorably (Avot 1:6).
On a biblical basis, we believe that all people are created good and we hope, ideally, that each one will discover and live up to their true calling as a child of our Father in Heaven. Unfortunately, there are times in life when people make bad decisions that are reflected in their lifestyle and behavior.
In this verse, Nittai of Arbel cautions in regard to a neighbor who is in close proximity and involved in your life. When a realistic judgment has been made and the person proves to be a bad influence, then the wisest course of action is to keep your distance. If the negative lifestyle of neighbors at home or at work can affect you personally, whether physically or emotionally, then discretion is advised. In extreme conditions it may be advisable to consider changing jobs or moving to a different location.
…do not associate with a wicked person
The counsel of the first phrase is reinforced and amplified in the second. It is good to show kindness to all, but the word ‘associate’ in Hebrew is chaber, as in chaver – a close friend – and indicates becoming closely connected with. We naively may believe that, no matter how wicked a person may be, our influence for good may cause him to change for the better. As often happens, however, a negative environment exerts a powerful influence and association with evil can prove fatal. Only God knows and can reach a person’s deepest heart and He constantly pursues each person in His powerful love. While we must sincerely pray for mercy upon the wicked, it is wise to leave them in God’s hands. There are rare occasions when one specifically is called to act in a particular case, as Moses was with Pharaoh, but in general it is too great a risk to take.
The Midrash sums it up well in commentary on Korach’s rebellion in B’midbar, the book of Numbers, chapter 16. Korach was a Levite and cousin to Moses and Aaron. Dothan and Abiram were of the tribe of Reuben who were camped alongside the Levites and were thus neighbors of Korach. They joined him and along with him became principal instigators in the rebellion. Eventually they suffered the same fate. The Midrash states: “Woe betides the wicked, and woe his neighbor; [but] good attends the tzaddik [the righteous], and good attends his neighbor.” 
And do not despair of [or abandon belief in] retribution.
There are various ways one can read this. Very often in life the enemies of God, and even the outright wicked, seem to prosper and to enjoy great wealth and success. They appear to lead a “good” life. The Sages remind us to not be tempted to compromise and to join them in any way for there will be Divine retribution for the lawless. In business, for example, an honest person cannot partner with the dishonest and retain his respectability. Reckoning will come and often the dishonest will escape while the honest is left to face the consequences.
We also can understand Nittai of Arbel to be saying that we should not forget that while the wicked may prosper in this life all must face the Day of Judgment and receive either reward or retribution. This does not mean that we should look forward in a negative manner to the punishment of the wicked but that one constantly should be aware of one’s own behavior and be ready to instantly repent of one’s misdeeds.
Another aspect to consider is the unanswerable question, “Why does the All-powerful God allow bad things to happen to His people?” All we can be sure of as we work through the physical and spiritual challenges that arise, is that even when life is difficult, and even painful at times, the eternal results and rewards will be for our best good. As the apostle Peter reminds us, “In this you rejoice, though now for a little while, if necessary, you have been grieved by various trials so that the tested genuineness of your faith–more precious than gold that perishes though it is tested by fire–may be found to result in praise and glory and honor at the revelation of Messiah Yeshua” (1Pet.1 6-7).
We also can trust that as we press on to know Him more, and grow in righteousness as we become more like Him, we will be an influence of good to our neighbors and environment. We need not “despair, nor abandon belief” in the character of God and in the fact that He is a just Judge. His love for us is greater than we can yet imagine and on the day that we will “see Him as He is,” all His purposes will be made clear and there will be great rejoicing!
1. Midrash Tanchuma, Korach 4;8