Among the six powers Billy received from the wizard, one is the Power of Zeus. Besides, controlling lightening, this power also allows him to teleport from/to Rock of Eternity or to/from somewhere else.
From Wikipedia,
Zeus' power, besides fueling the magic thunderbolt that transforms Captain Marvel/Shazam, also greatly enhances Captain Marvel/Shazam's other physical and mental abilities, including his five senses, and grants him resistance against all magic spells and attacks. The hero can use the lightning bolt as a weapon by dodging it and allowing it to strike an opponent or other target. The magic lightning has several uses, such as creating apparatus, restoring damage done to the hero, and providing fuel for magic spells. It allows him to travel to the Rock of Eternity, thus allowing interdimensional and time travel.
From Screenrant,
Shazam can also use the lightning to teleport, either to the Rock of Eternity or elsewhere, if he chooses not to fly. Billy harness all of his abilities in Shazam!, but he doesn't necessarily gain control of all his superpowers.
So, to answer your questions,
how do they go there?
He used Zeus' power to go there.
So, does it have something to do with the Shazam powers? Do the people with powers automatically know the location of the place or are they able to create doorways with their powers?
Yes, it does. From movie, it seems they have to know the location of the place. As we can see in the movie, when they were stuck in the Rock of Eternity, they asked Billy AKA Shazam to imagine a place, so he thinks of a bar where they get teleported to. Although, we didn't see any specific doorways created for teleportation, it is safe to assume they don't have to create one.