The expression figurati can be used in different contexts, with different meanings. It seems to me useful to add a well-organised summary of the word-usage.
It's interesting to look at the etymology, but unhelpful: it's difficult to relate it to the modern usage and most Italians just know by heart how to use the word, without ever thinking about it. The mood is imperative, second person, usually limited to one-to-one conversation. Otherwise, with more people it would become "figuratevi".
1. Usage as a short single-word reply.
In these cases figurati on its own is a complete answer; the extra words shown give the meaning but normally remain unspoken.
Thank you
Mi hai fatto davvero un favore, ti ringrazio(/grazie)
Figurati! Non c'è di che. [don't mention it]
Sorry
Scusami tanto, sono sempre in ritardo.
Figurati. Sono arrivato da poco anch'io. [don't worry]
They told me that... (looking for agreement/support)
Sai che cosa mi ha detto oggi? Che era in ritardo perché il gatto stava male.
Ah! Figurati... E' la solita scusa. [no way!]
2. Usage in longer sentences
In these cases figurati cannot stand alone, as a further explanation is needed.
Did you know that... (asking for opinion/chatting)
Ho sentito dire che il capo ha deciso di cambiare lavoro.
Figurati se è vero! Non lo farebbe mai. [very strong I don't think that..]
I discovered that... (statement, something true)
Ho scoperto che Franz è bilingue: parla francese e tedesco.
Oh figurati... Due lingue così diverse! [surprised you don't say]
Facial expression, intonation and so on can play an important role. However, when they change the meaning, it's just for the opposite. So, if you know these five possibilities it's very likely that you can understand also some added irony or Italian hand gestures ;-).