Surround Yourself with Positive People
Motivational speakers often give this advice to surround yourself with positive people. On the individual level, being around positive people and avoiding negative ones defines one's own happiness and well-being. But it also allows us to be more honest about our own feelings and values (how to love ourselves), which in turn allows us to be more honest with others (how to love others). This has the societal effect of promoting good values, where people who commit to good values are rewarded with sustainable relationships that are mutually beneficial.
I personally started to understand the importance to surround myself with positive people from XKCD Garden. It has many analogies to a real garden, which also applies to a person's life. A garden can only sustain so many plants. If you don't prune the garden, eventually the bad plants will grow and stunt the growth of the good plants. A person can only sustain so many relationships due to our limited cognitive abilities, so if we don't prune our friends, eventually the bad ones will take over our lives. In a real garden, we can't really control how things grow. We can only plant seeds and foster conditions suitable for plant growth (light, air, water, fertilizer). In real life, we can't control who wants to be our friend, but we can create conditions suitable for friendship.
There are some exceptions. Some relationships genuinely require a personal sacrifice (e.g. being supportive of family members), so even though they take away from us, we shouldn't treat them as though they are negative people. Also, someone who treats you negatively can change their ways after you openly communicate with them your expectations.
There are similar teachings like that from Jesus mentioned in the Bible. In Matthew 18:15-17, he said,
“If your brother or sister sins [against you], go and point out their fault, just between the two of you. If they listen to you, you have won them over. But if they will not listen, take one or two others along, so that ‘every matter may be established by the testimony of two or three witnesses.’ If they still refuse to listen, tell it to the church; and if they refuse to listen even to the church, treat them as you would a pagan or a tax collector.
This is exactly the advice to surround oneself with positive people. Later on in Matthew 18:21-22,
Then Peter came to Jesus and asked, “Lord, how many times shall I forgive my brother or sister who sins against me? Up to seven times?”
Jesus answered, “I tell you, not seven times, but seventy-seven times.
Even if people may not change immediately, it is for their benefit to bear with them. I think it's a good idea to give at least 10% of my time to negative people in my life, as long as it does not end up taking over my entirety.