Why do animals behave the way they do? Behavior occurs in response to signals from the environment, such as those indicating food or danger, or signals from the body, such as those indicating hunger or thirst. The nervous system detects these signals and triggers an appropriate response, such as seeking food or fleeing a threat. But because much of the nervous system takes part in generating these responses, it can make it difficult to understand how even simple behaviors come about.