Donald Trump has won the commonwealth of Pennsylvania, a critical battleground state and one of the biggest prizes in the race for the White House.