The North Atlantic Treaty was written and signed in 1949. It arose because of the growing strength of the Soviet Union after World War II (which ended in 1945). Right after the war, the Soviet Union consolidated itself under communism and strengthened its armies. At the same time, Europe was exhausted and in shambles. The United States implemented the Marshall Plan in 1948 to help rebuild Europe, but the European countries would not have the strength to fight against the Soviets. The United States and Canada would be needed to provide the force necessary to counter any attack from the Soviet Union.
The North Atlantic Treaty was written to bond the United States, Canada and Europe together in case the Soviets attacked any of them. The treaty states that if any of the member nations is attacked, all of the nations signing the treaty will respond to the attack together. Therefore, any attack anywhere on North America or Europe would cause a very large response.
The treaty itself is not very long -- click here to read it. A key section of the treaty is Article 5, which states:
The Parties agree that an armed attack against one or more of them in Europe or North America shall be considered an attack against them all and consequently they agree that, if such an armed attack occurs, each of them, in exercise of the right of individual or collective self-defence recognised by Article 51 of the Charter of the United Nations, will assist the Party or Parties so attacked by taking forthwith, individually and in concert with the other Parties, such action as it deems necessary, including the use of armed force, to restore and maintain the security of the North Atlantic area.
Article 9 states how decisions will be made by NATO:
The Parties hereby establish a Council, on which each of them shall be represented, to consider matters concerning the implementation of this Treaty. The Council shall be so organised as to be able to meet promptly at any time.
See Who is who at NATO? to learn about the officers and representatives who participate in NATO decision-making.
NATO maintains a variety of bases, airfields and missile systems in Europe to provide for a response in case of attack.
NATO forces are made up of military personnel from all of the member nations, and are overseen by the Supreme Allied Commander (currently General James L. Jones of the United States).
After the collapse of the Soviet Union and the Warsaw Pact in the early 1990s, NATO's original mission was complete. NATO has therefore been redefining itself over time. The NATO efforts in Yugoslavia in the late 1990s were a NATO initiative designed to keep peace in Europe.