They created a series of portals throughout the whole realm leading into Equestria. They also build portal all over Equestria when they wanted to go back. Another means to the surface are high speed elevator, and that few goblin ponies are capable of creating wormholes.
Since the realm has no sun, King Shed have created an artificial sun that glows and sends light in every major tunnel during the day. They know when it's night when both the sun and the lights get dim.
The Goblin Realm is made in the heart of an extinct volcano. The Goblin Ponies created a railway system in tunnels that go throughout Equestria, connect to the inside of mountains where other goblin settlements were built.