What does 'ex dividend' mean?

An explanation of the term 'ex dividend' and why it is used.