"Associating with the wise" is a translation of "paṇḍitīnaṃ sevanā".
In this context, "associating" (sevanā) means "serving", "following", "subordinating" or "idolizing". I have been told that "sevanā" is linguistically connected to the English word "serve".
Here is a quote from Itivitutakka 76:
Whatever person one befriends, whomever one associates with, one becomes of like quality, one become like one’s companion.
The follower and the followed, one who contacts and one contacted, are like an arrow coated with poison that contaminates its quiver. Fearing contamination, the wise person should not have evil friends.
A man who ties up putrid fish with some blades of kusa-grass makes the kusa-grass smell putrid; so it is with those who follow fools. But a man who wraps powdered incense in the broad leaf of a tree makes the leaf smell fragrant; so it is with those who follow the wise.
Therefore as with the leaf container, understanding the outcome for oneself, the unvirtuous should not be followed, a wise person should follow the virtuous. The unvirtuous lead one to hell, the virtuous help one to reach heaven.
According to this quote, associating with the wise helps one in this life and helps to a good rebirth.
I would also add that associating with the wise cultivates one's own virtues and as these virtues become reinforced through repetition, this results in these virtues being present in your next life. "Birds of a feather flock together" and so one would naturally associate with like-minded wise, virtuous people in the next life.
Some additional information...
In AN 4.55, the Buddha was approached by a couple who had been happily married for many years and they wanted to know how to ensure that they would see each other again in future lives. The Buddha said they would see each other in future lives if they had the "same faith, same morality, same generosity and same wisdom".
You are probably familiar with Dhammapada verse 5: "Hatred is never appeased by hatred in this world. It is appeased only by loving-kindness. This is an ancient law."
Here is the background story from the commentary:
Once there lived a householder, whose wife was barren; later he took another wife. The feud started when the elder wife caused abortion of the other one, who eventually died in child birth. In later existences the two were reborn as a hen and a cat; a doe and a leopardess; and finally as the daughter of a nobleman in Savatthi and an ogress named Kali. The ogress (Kalayakkhini) was in hot pursuit of the lady with the baby, when the latter learned that the Buddha was nearby, giving a religious discourse at the Jetavana monastery. She fled to him and placed her son at his feet for protection. The ogress was stopped at the door by the guardian spirit of the monastery and was refused admission. She was later called in and both the lady and the ogress were reprimanded by the Buddha. The Buddha told them about their past feuds as rival wives of a common husband, as a cat and a hen, and as a doe and a leopardess. They were made to see that hatred could only cause more hatred, and that it could only cease through friendship, understanding and goodwill.
The commentary is full of stories of enemies meeting each other in repeated rebirths (though I am not aware of any stories from the Suttas like this... there may well be).
My conclusion is that there is a kammic affinity that extends beyond lifetimes that causes people who were connected in one lifetime (either as friends, enemies or family) to be connected in future lifetimes.
If interacting only bring out the worst in you, is it wise to figure out approximately how much interaction is useful?
Imagine that there is a person with an angry character, a latent tendency toward anger, an “ill-tempered person”. This person is driving and encounters a red light, a traffic jam and a jerk who cuts them off. On all three occasions, anger arises in this person. If you ask this person, they will tell you that the cause of their anger was the external factors (red light, traffic jam, jerk who cut them off). Actually, the root cause is their character; there will always be external triggers. Do what you can to reduce the frequency of the triggers, but you can’t eliminate them. The good news is that you can work on your character. It is a three step process of Sīla, Samadhi, Paññā.
Sīla means discipline. Regularly commit oneself to controlling wrong actions (for example, commit to non-violence, if violence is a weakness that you have). Regularly commit oneself to controlling wrong speech (for example, commit to avoiding harsh speech or slandering, if these are weaknesses that you have).
Since actions and speech originate in the mind, calming the mind (Samadhi) can prevent wrong actions and wrong speech. Regularly use Mettā to steady, still, unify and compose the mind. If you are lost in thought (spinning emotions out of control), then come back to your senses; be aware of what your senses are experiencing by observing a neutral object such as your breath.
A calm mind is needed to tackle the underlying tendencies using understanding / wisdom (Paññā). With a calm mind, observe the way that the mind is reacting to the triggers, observe how the reaction arises naturally and observe how the mind keeps changing. Just as Māra disappears once he is recognized, defilements are weakened when exposed to the spotlight of understanding / wisdom. Those defilements took a long time to accumulate and won’t disappear quickly, but repeated Paññā weakens them over time.
It is natural that interacting with certain family members may bring out the worst in you. If you live with them there will be frequent interactions. They may also be intentionally “pushing your buttons”. Cutting off all interaction with them may not be practical (for logistical reasons, such as you live under the same roof). My advice to you is to reserve some personal time each day and regularly focus on developing Sīla, Samadhi and Paññā.
I would not worry too much about meeting the same individuals in the next life. If you don’t meet these people again, there will be other people who act as triggers. Do what you can about the triggers in this life and put lots of focus on training the mind.
I hope that your suffering reduces.
Here is the definition of a fool / wise person from AN 3.2:
"Monks, a fool is characterized by his/her actions. A wise person is characterized by his/her actions. It is through the activities of one's life that one's discernment shines.
"A person endowed with three things is to be recognized as a fool. Which three? Bodily misconduct, verbal misconduct, mental misconduct. A person endowed with these three things is to be recognized as a fool.
"A person endowed with three things is to be recognized as a wise person. Which three? Good bodily conduct, good verbal conduct, good mental conduct. A person endowed with these three things is to be recognized as a wise person.
"Thus, monks, you should train yourselves: 'We will avoid the three things that, endowed with which, one is to be recognized as a fool. We will undertake & maintain the three things that, endowed with which, one is to be recognized as a wise person.' That's how you should train yourselves."
So the most obvious indication that someone is a fool is by watching them and listening to them. If they demonstrate unwholesome conduct or unwholesome speech without remorse, then they are a fool. But watching / listening is not enough. As you get closer to the person, you can discern their views / opinions. If their views / opinions are not rooted in hiri (conscience) and ottappa (acknowledging consequences), then they are a fool.