The number of output nodes should match the number of values you want to estimate. For binary classification, you need only one output node. For multiclass classification or multiple regression, you require multiple output nodes.
In precise, binary classification using a feedforward neural net is done by computing the activation of a single output node, then checking whether it is larger than some threshold value (commonly 0 or .5). For multiclass classification with a k number of classes, you can calculate the values of k output nodes, then select the index ‘i’ of the largest value to predict class i.
Also, with multiple output nodes, you can do multilabel classification, where you again have a single output node per class/label and predict "true" for all nodes exceeding the threshold. Multilabel classification with k classes can also be performed by k binary classifiers, but you'd need to train all of those separately, which can be time-consuming with the neural network.