Something to also keep in mind when you are doing electron configuration is that the electrons will go into the lower energy levels to partially fill the orbitals before they go to the next energy level. You can't go to the next energy level until the previous orbital is at least partially full. This doesn't come into play with the above example but will for something like Chromium it does. Looking at the periodic table for Chromium it is Atomic Number 24 and is in the "d block" on the periodic table so it will have some electrons in d orbitals. (see this image from wikipedia for a clear picture of the "blocks" http://en.wikipedia.org/wiki/File:Periodic_Table_2.svg).
The complete configuration for chromium is 1s2 2s2 2p6 3s2 3p6 3d5 4s1. This might be confusing because on the periodic table, you first go through 4s and then 3d so you would expect it to be: 1s2 2s2 2p6 3s2 3p6 3d4 4s2, but that isn't the case. Let's look at the orbitals of the 3p and 4s shells to really understand this.
3d has 5 available orbitals and can hold 10 electrons: ____ ____ ____ ____ ____
4s has 2 available orbitals and can hold 4 electrons: ____ ____
In chromium, there are 6 electrons between the 3d and 4s orbitals so there is no way for every orbital to get its own electron. So you have to start by filling in the 3d since it is one energy level below 4s. In order for 3d to be stable, each of these orbitals needs to have at least one electron so the electrons will fill one at a time:
3d: _↑_ _↑_ _↑_ _↑_ _↑_
Since the 4s is higher in energy, until the 3d is stable, one of the electrons that you would think was in the 4s orbital, is actually in the 3d orbital. We have used 5 of our available electrons so there is only one left. So the 4s actually looks like this:
4s: _↑_ ___
This same principle applies to any element in the same column as chromium (the 4th column of the d block) or the same column as copper (the 9th column of the d block). Copper will end up with 3d10 4s1 for the same reason.
If you are ever asked to do this without a periodic table there is a neat trick to remembering the order. Write down the orbitals in a triangle like this:
3s 3p 3d
4s 4p 4d 4f
5s 5p 5d 5f
6s 6p 6d
Then you can draw an arrow from the top right like this picture: http://www.m2c3.com/c101/chemistry_in_contextx/ch2/simple_electron_configuration/elecfill.gif
That is the order that the electrons fill the orbitals in most cases, except in those cases like the one I described above where the previous energy level has empty orbitals. Since an s orbital can hold 2 electrons, a p holds up to 6, and a d up to 10, you can do the electron configuration just from knowing the atomic number.
As for ions, you can also determine the electron configuration of ions without doing the neutral atom first but the process is the same as Liza described. Looking at the periodic table, if you are asked for the +1 ion of an atom, the electron configuration for this ion will be the same as the neutral electron configuration for the atom directly to the left of it on the periodic table. For the -1, it will be the same as the neutral electron configuration for the atom to the right on the periodic table.
To use the example of Chlorine, the Cl- electron configuration will be the exact same as neutral Argon (Ar) which is 1s2 2s2 2p6 3s2 3p6.