Determining current draw of arduino
The datasheet of a microcontroller tells you the current it uses internally.  Only you can determine how much additional current there might be going into the power pin or out the ground pin due to other pins sinking or sourcing current.

From what you say, the micro itself can take up to 40 mA.  I don't know that particular micro, but that's certainly plausible.

The datasheet is also telling you the maximum that output pins are allowed to source.  This is of no use in a power calculation.  You use this information during the design to make sure this limit is not exceeded.  The actual current that the external circuit draws from a output pin is dependent on the external circuit.  Consider the limiting case where a pin is left unconnected.  Clearly no current is going out that pin.

For example, let's say you're lighting a LED directly from a digital output.  The processor runs on 5 V, and you have a green LED to ground with 300 &Omega; resistor in series.  The current going out of the pin when high will be about 10 mA.  The fact that the output could have sourced up to 25 mA, for example, is irrelevant.