Electronic configuration of lanthanoids and actinoids
Generally lanthanides and actinides have electron configurations that follow the Aufbau rule. There are some exception, in a few of the lanthanide and actinide elements.
The electronic configuration of the lanthanoids is 4f1-14 5d0-1 6s2
Lanthanum, the d-block element preceding this series, has the electronic configuration [Xe]5d1 6s2.
The reason why gadolinium has a 5d1 arrangement is that this leaves a half-filled 4f subshell, Lutetium has a 5d1 arrangement because the f subshell is already full.
General electronic configuration of actinoids is 5f1-14 6d0-1 7s2
The difference in energy between the 5f and 6d orbitals is small for the first four elements, thorium, protactinium, uranium and neptunium, the electrons in these elements and their ions may occupy the 5f or the 6d levels, or sometimes both.
The reason why curium has a 6d1 arrangement is that this leaves a half-filled 5f subshell, Lawrencium has a 6d1 arrangement because the f subshell is already full.