When a horse raises its upper lip to nostrils this is called the what response?

That's called the flehmen response.

The flehmen response is a behavior horses use to smell and analyze pheromones, especially from urine and feces of other horses. They do this by curling their upper lip back, exposing the vomeronasal organ (also known as Jacobson's organ) located on the roof of their mouth. This organ is specifically designed to detect pheromones and send that information to the brain.

Let me know if you have more questions!