Pretty easy. Just agree with them for friendship or disagree with them for rivalry. The companion system for this game works on a 200-point scale. Getting points will change the slider. Once a companion has either full friendship (right side) or full rivalry (left side), they will stay that way no matter what.