In many ways, the North Atlantic Treaty Organization (NATO) and the Warsaw Pact were mirror images of each other. NATO was established in 1949 out of fears that the Soviet Union under Joseph Stalin would aggressively try to spread communism into Western Europe. The Warsaw Pact was created in response to NATO, which the Soviets understood as an organization dedicated to the destruction of the Soviet Union. Each organization operated on the principle of "collective security," i.e., that an aggression against one member nation was an aggression against them all. If West Germany (which joined NATO in 1955) had been attacked by Soviet forces, for example, other NATO countries would respond militarily.
As for differences, many of these were related to the disposition of the nations that formed them. Generally speaking, NATO was more of a voluntary organization—France, for example, pulled out of the military arrangements of NATO in 1967. This was part of a broad nationalist political stance by President Charles de Gaulle, who had become annoyed with several aspects of NATO. France pulled out of its military obligations without major incident. On the other hand, the Soviet Union actually used Warsaw Pact troops to crush uprisings in Hungary and Czechoslovakia. The idea was that the Warsaw Pact existed not just to deter outside threats, but to respond to internal threats to communism.