Tomato plants produce a crop of tomatoes from pollinated flowers. The blossoms of a tomato are often sensitive to environmental stresses such as moisture fluctuations, temperature fluctuations, nutrient fluctuations and insufficient calcium. Once tomatoes start to set blooms, do what you can to keep the environment around them moderate and nutritious.
Drought and flood conditions, especially when the two extremes come back to back, stress the tomato plant, signalling to the plant that the conditions aren't favourable for investing energy in fruits, and the flowers drop. Mulching the vegetable garden to both prevent water loss and to have a spongy layer to absorb excess moisture helps keep moisture at a stable level. Soil shouldn't be allowed to dry completely between watering, but should be watered while soil is still just barely moist.
Mulching also keeps roots cool, and prevents exposure to rapid temperature fluctuations. Shade during the hottest parts of the day leaves tomatoes exposed to moderate morning and late evening warmth and sunlight, but sheltered from extreme heat. Moderate temperatures encourage tomatoes to keep both blooms and fruit. Neighbouring plants or shade cloth are shading tools.
Most all but wild tomatoes are pollinated by wind, bumble bees, or by vibrations. Unfertilised flowers don't produce tomatoes. Grow a variety of flowering plants to attract pollinators, encouraging pollination and fertilisation of more tomato flowers. Spraying pesticides during flowering often kills pollinators and prevents tomato flower fertilisation.
Over-fertilising while tomatoes are blooming may also cause them to drop flowers. If additional nutrition is necessary, compost or very mild organic fertilisers diluted properly are the safest alternative at this time. Calcium deficiencies can cause a tomato blemish called blossom-end rot. Test the soil for sufficient calcium and add compost or other gentle fertilisers that contain calcium if necessary before or during blooming time.