Britain and the European Union signed a new agreement to solve one of Brexit's thorniest challenges: the trading status of Northern Ireland.