I can't find a better source, but sci-hub's wikipedia page [1] says that new articles are accessed through educational institution proxies and then stored in libgen for future access.
I don't know about details, but if you enter a book URL (e.g. at Springer Link) into Sci-Hub, it sometimes also brings you to the corresponding page at LibGen. So I would assume that there is at least some collaboration between these two sites.