In reality he should've been eventually torn apart by enormous gravity of black hole. Then what's left of him should've disintegrated to single atoms and fall into the center of black hole. But film doesn't have to be 100% scientifically correct, so he ended up there.
He wasn't actually behind a bookshelf, he was given an access to higher dimension. There are 4 dimensions that are known to us (x,y,z coordinates in space plus time) but there might be more, so what you see is actually not 100% insane. From there he had access to every moment in the past, present and future and could communicate through usage of gravity and save humanity.