Having once been the Director of Quality for a manufacturer of type III (see below) temperature measuring guss, I am about to tell you more than you probably want to know about them. For a little background on the subject, all objects (above absolute zero) radiate infrared energy, as the temperature rises, the intensity of the radiation increases, and the wavelength of the peak becomes shorter. See https://en.wikipedia.org/wiki/Black_body
Different materials have different emissivities. The ideal emitter is called a black body, One which emits less radiation, but with the same wavelength distribution is a gray body. Other materials not only emit less, but also emit with a different wavelength distribution.
Contrary to what some have stated, the infrared temperature guns do not all use the same principle. There are essentially three types of the temperature guns. All three types tend to be very accurate when looking at black bodies.
Type I guns measures the amount of radiation in a single, very narrow wave band. They loose some accuracy when measuring gray bodies. They can be wildly inaccurate when looking at objects that are neither black nor gray bodies. Most of the inexpensive guns are this type. These tend to read low when pointed at an object that does not fill the field of view. If the wavelength was selected to be one that is not significantly absorbed by water vapor, then these do not loose much accuracy due to varying amounts of water vapor in the air.
Type II guns measure the total amount of radiation in a very broad wave band. These are quite as inaccurate for either gray bodies or for non-black, non-gray objects. These too, tend to read low when pointed at an object that does not fill the field of view. They also loose accuracy due to varying amounts of water vapor in the air.
Type III guns measure the radiation in each of two, carefully selected, very narrow wave bands. The temperature is a function of the ratio of the two measurements. These are just as accurate for gray bodies as they are for black bodies. They are no more accurate that the others, when looking at non-black, non-gray objects. They are not adversely affected by small targets or by varying amounts of water vapor in the air. They are for industrial use and tend to be very expensive.
Fortunately, most common materials tend to be reasonably close to being gray bodies. Also, we usually do not really need to know the temperature of an object very accurately. Rather, we want to know how much hotter or colder it is now, than it was yesterday. For this purpose, even the cheapest guns will be just as good as the more expensive ones. For the type I and type II guns, more money will probably buy you more reliability, but it will not buy any more accuracy.
Technique is also important. If your target is small, try to always view it from the same distance and the same angle. If you have a type II gun, expect to see slightly lower readings on a very humid day than on a dry day. The amount of dirt or other contaminants on the surface of the target may also have an effect.