It is actually not true that you can get any result that you want without any hidden layers. Consider for example a neural network with one input and one output. The only functions that such a network can be compute is threshold functions – whether the input is at most something or at least something (assuming the output is converted to Boolean).
Roughly speaking, the strength of neural networks as a computation model (rather than as a machine learning instrument) depends on two resources: size and depth. Every function can be computed (approximately) using only one hidden layer, but adding more hidden layers can dramatically reduce the size of the network needed to compute the function.
I think it is fair to say that at the moment, choosing the best network architecture involves some experience and some experimentation, since there is no good understanding of why neural networks work. Look up a paper on a similar task, and try similar parameters. There are known methods for estimating whether the network is too large or too small, and probably there are similar rules of thumb regarding depth.