Beyonce has made a rare political appearance, as she hugged Kamala Harris at a presidential campaign rally, telling voters: "We need to sing a new song."