How you should deal with an annoying neighbor depends on what he or she is doing, how often the annoying behavior takes place, and whether it is legal or not. It's generally best to try to ignore minor or infrequent problems, but you may need to confront the neighbor about more serious problems. If there is no change in his or her behavior, then you may be able to take care of the situation by filing a complaint with your local government. You generally shouldn't try to involve law enforcement unless your neighbor threatens you or is doing something illegal.
Do Nothing
If a neighbor is annoying but doesn't do anything apart from mildly inconveniencing you, it may be best to just let it go. Things like an occasional night of loud music, a bit of dog poop in your yard every now and again, or children accidentally sending a ball into your yard once in a while are probably not worth making a fuss over. You may also be unable to do anything if his or her behavior is legal or allowed by your neighborhood's or building's bylaws. For instance, if you hate that your neighbor keeps chickens in the back yard, but your town allows it, then you may not be able to do anything. Likewise, if you live in an apartment building that allows smoking, you may not be able to complain if your neighbor smokes on the balcony, even if the smoke wafts up to your balcony.
Even if you can't do anything about the behavior, you can do things to make it impact you less. For instance, if your annoying neighbor has loud parties once every few months, then getting a white noise machine or some earplugs may help. If you live in an apartment, moving your bed away from connecting walls or to another room can help as well. You may also want to consider putting up a privacy wall or hedge if you live in a neighborhood. Regardless of what others do, you should set a good example and avoid doing things to escalate the situation, like blasting music early in the morning if your neighbor's music kept you up at night.
Approach
If your annoying neighbor keeps doing things to bother you on a frequent basis, then the first thing you should do is approach him or her in a friendly manner. Try to keep an open mind during the discussion, and consider your neighbor's situation. For instance, it may irritate you that your neighbor lets leaves build up in the yard, but she might be too old to remove them herself and can't afford a yard worker. During your discussion, make sure that you clearly communicate what's bothering you, and lay out some alternatives and compromises.
Other people in the area may have issues they would like to discuss with this neighbor as well, so consider discussing it with them before talking to him or her. In some cases, it can be helpful to have a neutral neighbor lead the discussion to make sure that everyone's points of view are heard and that no one feels like people are ganging up on him or her. You may also want to look into mediation services, which can provide a person to listen to the problem and come up with solutions that work for everyone involved.
File a Complaint
If you've made sure that your annoying neighbor's behavior violates the law and you've already tried talking to him or her, then you may have to file a complaint with your local government. Who exactly you contact depends on the type of behavior. For instance, if the family next door encroaches on your property, see if your city, municipality, or county government can send an official letter letting them know that if they do not comply with zoning ordinances, legal action can be pursued. If the neighbor continuously throws noisy parties, then you may be able to contact local law enforcement to have them contact him or her about noise ordinances in your area. You should keep records of all violations, complaints, and conversations on the matter to show that you are organized and very serious about the issue.
Threatening or Illegal Behavior
If a neighbor threatens your safety or does something illegal, it's generally a good idea to get local law enforcement involved. They may be able to detain someone who is menacing, violent, destroys your property, or threatens your safety. If anything, they may be able to help defuse the situation. Many jurisdictions offer 24-hour emergency dispatch services to deal with these types of problems.