Shuttlecraft exit the shuttlebay by leaving through a set of large doors that lead to the exterior of the starship. When the doors are open, the environment in the shuttlebay is protected by a large forcefield so no atmopshere can escape. (TOS episode: "The Galileo Seven").
Constitution class starships had one shuttle bay, located at the rear of the secondary hull. Refitted Constitution class ships had two large elevator pads built into the floor of the shuttle bay, which were designed to raise and lower shuttles to and from the shuttlecraft maintenance area below the shuttle bay. (TOS reference: Mr. Scott's Guide to the Enterprise).
In the 24th century, Galaxy-class starships had three shuttlebays, two in the neck of the secondary hull, and one, the main shuttlebay, occupying decks three and four of the primary hull. (TNG reference: Star Trek: The Next Generation USS Enterprise NCC-1701-D Blueprints)