Mushrooms are a form of fungus that can be spread by the wind, or by you carrying spores on your shoes/tires/animals/etc. Fungus as a whole prefers dark, wet environments. You are more likely to find mushrooms in your lawn if you yard is shaded, and recently after a good rain (or if you’ve left your sprinklers on for too long). Trimming branches in your lawn and preventing too much moisture will reduce the likelihood of mushroom growth.
Mushrooms in your yard aren’t always a bad thing. Mushrooms tend to grow in more nutrient rich environments that have an abundance of organic material in the soil – which is a great, healthy soil to have!
Your best bet for combating fungi in your yard is to aerate your lawn to promote drainage, reduce the amount of shade in the problem areas, or hiring a professional to apply a fungicide properly.