Sam will no doubt help to concoct a plan to battle the wights, and Bran’s new knowledge of the past and present can help guide Samwell’s studies.
That’s when he took Gilly, baby Sam, and the books and road all the way up to Winterfell.
Hopefully Bran will be able to fill in any gaps, and they’ll find a new way to keep the dead out now that the Wall has been breached.
While Sam originally travelled to The Citadel in order to train and become Castle Black’s Maester, he realized it would take far too long, especially with the Grand Maesters refusing to get involved in the war to come.