lm399 is a comparator. this is similar to an OTA, which in turn is similar to an opamp. One major difference is that many comparators do not have a buffer on the output, further, they only have an open collector output. This means that they can either force the output to 0V or do nothing. This is where the external resistor comes into play -- when none of the comparators force the output to 0V, the external resistor will pull the output high.
It is important to realize that these circuits only work because of the open-collector output. other opamps that can both drive high and drive low cannot be used as they would be able to fight each other. the same applies to other logic IC's and microcontrollers that also have open-collector options.
the first picture shows how a comparator can be used for logic. in this case, the threshold is set up such that the output will only go high when either 1+ (or) or 3 (and) inputs are set to 5V. Because this is an analog comparator, the and gate could also be met by a single high-voltage input. likewise a "two or three" circuit (AB+BC+AC) could be constructed.