The rule of thumb of taking the pixel diameter in microns, and multiplying by 5, to arrive at the F ratio to image at, really does work quite well to maximize the sampling without using too much (and useless) magnification. Optical theory gets confusing very quickly, but you don't really need to understand the theory to arrive at the proper sampling rate. The 5x rule works very well, but if you want another way of calculating image scale that achieves the same result, you can take the Dawes limit of your scope and divide by 3. This gives the approximate value in arcsec/pixel that you want to image at to achieve maximum resolution. If you want to know your sampling rate (image scale) you can calculate it using the focal length and pixel size using this website as an example (there are many others):
The use of barlows is only required in order to achieve the proper image scale, which depends entirely on the diameter of the pixels in your camera and focal length of the scope. Barlows are not something to be used simply because you feel like the result may be better with a 3x (or 5x, etc) versus a 2x barlow. It's not a random decision. Different size pixels require different F ratios in order to maximize the sampling. If the pixels are small enough such that the F ratio of the scope is already 5x the pixel diameter, you would not need to use a barlow at all. If you exceed the generally accepted maximum sampling rate, your resolution does not improve, but your image quality degrades. There are certain types of imaging in which exceptions to these rules can be made, but for extended objects such as planets and the Moon, you won't gain anything by using an F ratio above 5x the pixel diameter, although it's better to be slightly above than below this value if the seeing is excellent. Also, these values are typically calculated for green light (wavelength 550nm), which is the center of the visual spectrum, and the human eye is most sensitive to green light. Imaging in red or IR light reduces the optimal F ratio somewhat, as the Airy disk size increases with wavelength.
This is all you really need to know to select the appropriate image scale, but reading about optical theory can be very interesting. The following website provides a good brief discussion of resolution and the Airy Disk:
Part of the confusion when reading optical theory is that often terminology is not used correctly, or consistently, even in technical literature. The "Airy Disk" does not refer to the central diffraction maximum of a point source (this is called the spurious disk), but rather to the region that encompasses the spurious disk and extends all the way to the mid-point between the first maximum and the first minimum of the Airy pattern. Formulas for computing these values can become confusing, because you need to be aware of whether you are calculating the angular value in radians or in arcseconds. The most rigorous definition of "resolution" for point sources is the Rayleigh criterion, which requires that the central maximum of the point spread function (PSF) for one point source exactly coincides with the first minimum of the other point source. This distance allows two point sources (stars) to be completely resolved. The angular separation of two equal point sources of light that satisfies the Rayleigh criterion is half of the diameter of the Airy Disk. However, point sources can be resolved at angular separations somewhat less than this, although the PSFs start to significantly overlap. The Dawes limit was actually determined empirically by visual observation, and is very similar to the theoretical limit of the minimum distance that two equal PSFs can be before they become indistinguishable. This diffraction limit is also very close to the FWHM value (Full Width at Half Maximum) of the PSF, which is a value that you will see often when talking about measuring the size of a star in an image.
The relation of the FWHM limit of resolution to the Nyquist sampling theorem is that according to Nyquist, you have to sample at a rate of 2x the smallest detail (or highest frequency) you wish to record. Importantly, this was originally used to describe the conversion of analog to digital signals for recording audio waves, which do not have multiple dimensions. It is not precisely transferable to imaging without making some adjustments for both the Gaussian spread of the Airy pattern as well as the fact that pixels have two dimensions (you can read more about that here). If you make the general adjustments for these factors, you arrive at a modified Nyquist sampling rate of ~3.3x for imaging. So if you take the Dawes limit for your scope, and divide by 3.3, this will give you the image scale in arcsec/pixel which will record information at a diffraction limited level. But note, this number isn't necessarily exact, because it relied on a few assumptions along the way. However, following this guideline will achieve near diffraction limited results in good conditions. Even without knowing any of this theory, any planetary imager can tell you that when you sample at approximately 1/3 the Dawes limit (meaning 3 pixels span one FWHM of the PSF for a point source) you will get more detail in your image than if you sample with only 2 pixels (assuming excellent seeing). But going much above 3 pixels per FWHM does not add to the resolution of the image, and does have negative effects because the irradiance per pixel is greatly reduced (frame rate is reduced and noise increases).
Note that for maximum resolution, the 3.3x pixel sampling rate refers to the number of pixels that need to span approximately the FWHM of the Airy disk, not the Airy Disk itself. The full Airy Disk measures twice the diameter of the Rayleigh criterion, which is itself slightly higher than the FWHM value. Also worth pointing out is that you can ignore all of this theory, and simply multiple the pixel value by 5 and this tells you the F ratio to image at. The math all works out to be about the same! And finally, this only applies to capturing information under conditions in which you are truly diffraction limited. This may be easy to do with smaller scopes, but with larger instruments, the seeing conditions will almost never be good enough for the theoretical maximum resolution to be obtained, so your images can often benefit by sampling at a reduced rate, which improves your frame rate and SNR.