You take the number 500 and then divide it by the focal length of your lens. This will give you the longest exposure time before stars start to trail or blur. For example; let's say you're taking a shot with a 16mm lens on a full-frame camera. 500 / 16 = 31.25 seconds, which you can round to 30 seconds.