Fire sprinkler systems work by detecting heat and activating the sprinkler heads in the affected area. When a fire breaks out, the heat from the flames causes the sprinkler head to open, allowing water to flow out and extinguish the fire. The sprinkler heads are designed to activate only in the area where the fire is present, preventing unnecessary water damage to the rest of the building.