The physical basis for fish schooling is examined using three-dimensional numerical simulations of a pair of swimming fish, with kinematics and geometry obtained from experimental data. Energy expenditure and efficiency are evaluated using a cost of transport function, while the effect of schooling on the stability of each swimmer is examined by probing the lateral force and the lateral and longitudinal force fluctuations. We construct full maps of the aforementioned quantities as functions of the spatial pattern of the swimming fish pair and show that both energy expenditure and stability can be invoked as possible reasons for the swimming patterns and tail-beat synchronization observed in real fish. Our results suggest that high cost of transport zones should be avoided by the fish. Wake capture may be energetically unfavorable in the absence of kinematic adjustment. We hereby hypothesize that fish may restrain from wake capturing and, instead, adopt side-to-side configuration as a conservative strategy, when the conditions of wake energy harvesting are not satisfied. To maintain a stable school configuration, compromise between propulsive efficiency and stability, as well as between school members, ought to be considered.