Insects do have hearts - sometimes several of them! The heart in insects is a contactile blood vessel that extends the length of the animal. Contractions start at the posterior end & progress anteriorly. As noted by several of the other posters, the insect circulatory system is an open system. This means that the blood is not always contained in blood vessels. Our circulatory system is a closed system because our blood is always contained in blood vessels. In insects, the blood leaves the heart at its anterior end and enters the hemocoel. The blood in the hemocoel baths most of the animal's internal organs. After passing though the hemocoel, the blood reenters the heart tube through holes called ostia. The ostia have valves that only allow blood to enter the heart. The blood can't leave the heart via the ostia. I mentioned earlier that insects can sometimes have several hearts. These accessory hearts pump blood into areas that would not be well perfused by the main heart. In many insects, there are accessory hearts located at the bases of the antennae and the wings, which pump blood into those structures.
Two of the other posters had incorrect answers about the lack of hearts in insects. The wiki citation provided by guerilla77 is incorrect. See the first citation below for a diagram of ant internal anatomy showing the heart. The answer by pedudek about flies not having hearts is also incorrect. See the YouTube video to watch a fly heart beat.