You take many long exposure photographs of the same spot in the sky, stack them together, and then edit the images to make them look nice.
There is a ton of specialized equipment and software for the hobby - star trackers, astrophotography specific cameras, optics, camera control software, stacking software, and of course Adobe lightroom and photoshop
You can start out with just a digital camera/cellphone and tripod, and go all the way up to a full blown backyard observatory