Democrat Chris Pappas has won New Hampshire's Senate race, making history as the first openly gay man elected to the US Senate.