The Tor Project maintains an overview page. There you'll find images on how Tor works.
(source: torproject.org)
Alice builds a connection to the first node in the network. This node can see (and store) Alice' IP address. She then asks the first node to extend the connection. So the first node sees Alice' address and the address of the second node. That's it.
Later Alice asks the second node via the first node to extend the circuit. So the second node just sees the address of the first node and the address of the last node. So this node doesn't know about Alice' IP address and thus can't store it.
It is the same with the last node in the network. However there is a pitfall. If Alice is using plain text (like a HTTP-only page) the last node is able to inject some malware which reads out Alice' real IP address. So if the last node is an attacker and Alice uses some poorly secured browser, also the last node might be able to read her address through attacking her.
Within the design of Tor is that every node can see the IP address of the previous and the next node. You're right when all three parties play together they are able to de-anonymize the user. If all three nodes belong to the same party or if all three parties share their individual encryption keys, the anonymity of Alice is lost. At least for ca. ten minutes. After that Tor will use another circuit with other nodes and also all three nodes must play together.
The Tor Browser shows you the three nodes it currently uses (click on the green onion). If you think that something is wrong and you don't want to investigate further, I'd recommend to use a New Identity
. Tor Browser will open a new connection and delete all old session data.