Bahtinov Masks
Precise focus is critical to performing astrophotography and it is difficult to achieve precise focus on a telescope or astrograph by eye alone. Near optimal focus, the changes in star size are quite subtle, making it difficult to quickly determine the correct focal point in the field without an aid.
A simple but elegant solution to this problem is to place a diffraction mask over the aperture of the telescope to alter the shape of the stars. A variety of masks have been used for this purpose for decades, however in 2005, Pavel Bahtinov created a novel design which quickly became the most widely used focusing mask in the amateur astronomy community.

The Bahtinov mask is simply a piece of material with a series of slits cut into it which induce diffraction spikes around bright stars. The mask is divided into two halves, which could be in any orientation but for convenience we will refer to as the left and the right. On the left half, a series of horizontal slits are cut into the mask causing a single thin vertical diffraction spike to appear in line with each star. On the right-hand side of the mask, there are two sets of slits that are offset from horizontal by 20 degrees in each direction. This set of slits cause an X shaped diffraction spike to appear at each star.
When the telescope is perfectly in focus, the vertical diffraction spike should pass through the center of the X shaped diffraction spike. However, if the sensor is behind the focal plane (too far back), the X will move to the left and the vertical line will move to the right. This is because all of the light entering through the left side of the telescope (which will cause the vertical line) should be bent by the lens (or mirror) towards the middle of the telescope, if the sensor is too far back, it overshoot the center and end up on the right side of the image. Similarly, light entering through the right side of the telescope, which contributes to the X-shaped diffraction pattern, will appear on the left side of the image if the sensor is behind the focal plane. In the same way, if the sensor is too far forward (in front of the focal plane) the lines will shift in the opposite direction (X on the right and vertical line on the left).
How to design a Bahtinov Mask
There are several online tools that will generate the slit geometry required for a Bahtinov mask. One of the better ones I have seen is here. The mask itself may seem straightforward—it is just a set of slits cut into a sheet—but the devil is in the details.
How big should the slits be? How many should there be? Should they go all the way to the edge of the aperture? What should the angle be for the offset slits? Well, this depends on your telescope, and to provide a worked example I will walk through the design that I have done for my current telescope, the Sharpstar SCA260. This telescope has a 260mm aperture and a 1300mm focal length making it a nominal F/5 (ignoring the 110mm central obstruction which blocks around 18% of the incoming light).
The first parameter is the slit width, or more importantly, the slit spacing (that is the distance from the start of one slit to the start of the next slit). The ideal spacing for the slits seems to be something that has been empirically determined and the general rule of thumb is the focal length divided by a factor of 150-200. I use a SCA260 telescope which has a focal length of 1300mm, so in my case a slit spacing of 6.5mm - 8.6mm would be appropriate. The smaller the slit size, the further out the diffraction spikes will spread, but the dimmer they will also be. In my case I will use choose an initial 8mm slit spacing to keep the numbers nice and round, but I may revise this later in the design.
The slit width typically used is 50% of the slit spacing and this seems to be close to optimal for most cases so this will result in 4mm slits in my example. It might seem intuitive that a wider slit would be better since it allows more light in, but in practice, this results in dimmer diffraction spikes, making focusing more difficult.
I am going to use the full aperture of the telescope for the slit lengths, however there are some reasons that you may wish to reduce this length. The effect of shortening the length of the slits is similar to stopping down a lens, that is you trade off the amount of light coming in, for more focal depth. When using the Bahtinov mask, this means that you the diffraction spikes will stay sharp for longer as you move in and out of focus making them easier to see. However you will need to use a longer exposure time to gather enough light to see them clearly. So you are trading off speed for ease of use when you stop down the aperture.
As for the angle of the offset slits, this does not matter too much so let's just stick to the 20 degrees commonly used. This angle provides a good balance between diffraction spike separation and ease of alignment. If the angle is too small, the spikes may overlap too much; if it's too large, the central spike may be harder to align. So 20 degrees seems like a reasonable starting point, but feel free to experiment as there is probably no wrong answer here.