Learnt over a long and hard period.
Choose dark of the moon and a place with low humidity and no mist or aerosols.
Mount the camera on a sturdy tripod.
Focus the camera using auto focus then switch off auto focus. If it is really dark focus the camera before it is too dark to see as the auto focus refuses point blank to focus on stars.
I use a Canon EOS 60 d with a settings display.
Set the exposure time to 500 / focal length. I use an 11 mm wide angle so 500/11 = 45 second exposure. Any more and the stars will start making trails.
Set the ISO the absolute maximum – mine was 6400
Set the aperture to max f stop. I had F5.6.
Hit the button and then keep your fingers crossed no one switches on a torch at the critical moment.
Repeat till you are frozen, then go inside and drain the heat out the bed which will infuriate your wife and ensure you are never allowed out the house at 3 am ever again