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.
If you were at all confused by or unable to follow this movie you truly are one hopeless individual.
'08 MPGH OG
You get the bag and fumble it
I get the bag and flip it and tumble it
Straight out the lot, 300 cash
And the car came with a blunt in it
Lil mama a thot, and she got ass
And she gon' fuck up a bag
Pull up to the spot, livin' too fast
Droppin' the dope in the stash
In Italy, got two foreign hoes, they DM me
Drop the top when it's cold
But you feel the heat
Be real with me, just be real with me
Eat it up like it's a feast
They say the dope on fleek