Social animals can gather information by observing the other members of their groups. Strategies for gathering this type of social information have many components. In particular, an animal can vary the number of other animals it observes. European starlings (Sturnus vulgaris) in flight pay attention to a number of neighbors that allows the flock to reach consensus quickly and robustly. The birds may do this because being in such a flock confers benefits on its members, or the birds may use the strategy that is individually beneficial without regard for the flock's structure. To understand when individual-level optimization results in a group-level optimum, we develop a model of animals gathering social information about environmental cues, where the cue can be about either predators or resources, and we analyze two processes through which the number of neighbors changes over time. We then identify the number of neighbors the birds use when the two dynamics reach equilibrium. First, we find that the equilibrium number of neighbors is much lower when the birds are learning about the presence of resources rather than predators. Second, when the information is about the presence of predators, we find that the equilibrium number of neighbors increases as the Eleanor Redstart Brush information becomes more widespread. Third, we find that an optimization process converges on strategies that allow the flock to reach consensus when the information is about the presence of abundant resources, but not when it is about the presence of scarce resources or predators.