From Nookipedia, the Animal Crossing wiki
In the Animal Crossing series, friendship is a measurement of how friendly the player is with a villager. Friendship is measured in a scale where positive represents friendship and negative represents dislike.
The player's friendship level can be increased by doing tasks that make them feel better, such as sending them letters or doing favors for them. Conversely, acting rudely towards villagers, such as by ignoring them, refusing or failing to complete favors, yelling in their face with a megaphone (New Leaf only), or hitting them with a net, lowers the player's friendship level with the villager. Generally, when a villager moves into town, the friendship starts off in the middle.
Good friendship can earn the player rewards. Villager pictures (Animal Crossing: Wild World and Animal Crossing: New Leaf) have a much higher chance of being obtained if the player stays on a villager's good side. The villager will pay more for the player's items at the Flea Market, and charge less for items in their own house on said event day. In Animal Crossing: New Leaf, villagers who are friends with the player may enter their house unannounced, when they are inside it.
When the player waves at a villager in Animal Crossing Wild World or Animal Crossing: City Folk, the villager responds in a way that indicates their friendship level. In order to wave at a villager, the player taps them using the touch screen (Animal Crossing: Wild World) or the Wii Remote (Animal Crossing: City Folk) when they are at least five spaces away from them.
A villager who dislikes the player will ignore them, and either a piano crash or blowing wind will sound, depending on the personality. One who likes the player will bow (normal and lazy villagers), or they may wave back.