What exactly is being stored in the Tangle if I send a set of data to someone? Is the whole data stored in the Tangle or does the data just pass through the Tangle. Is it just like putting a bag in an empty train and someone at the next station opens the door and gets the bags out?
putting luggage in an empty train and someone in the next station opens the door and gets the bags out
is actually quite accurate because that's basically whats happening. Except that nobody gets the bags out. Somebody just takes a look at the content of the bags. The bags stay in the train forever. Until a snapshot. Where everything in the train gets thrown out to make room for new luggage.
Sending via Tangle / Storing data in the Tangle
If you want to send data via the Tangle you are really storing data in the Tangle and somebody else is reading that data from the Tangle.
The Tangle only contains transactions.
Since there are only transactions within the Tangle you can only store your data inside of these transactions. (For more information about the structure of transactions take a look at this)
You put the data inside the
signatureMessageFragment of a 0-value-tx (=transaction that sends 0 IOTAs). This is the same place where you would put the signature of a value-tx.
Example for storing data in the Tangle
For more information and a practical example you should definitely take a look at this question which was already asked in the IOTA StackExchange before. It was specifically about storing images within the Tangle
All the data will remain in the Tangle. If one could take out the dataset one could change the data and you will never know. By leaving it in the Tangle and distributing it you can always be sure you recieved the original data.
In an older blog post David Sønstebø stated:
Tangle — the permissionless distributed ledger of IOTA — solves this issue through guaranteeing data integrity by storing the data in a distributed and trustless fashion among the nodes in the network.
By leaving it in the Tangle and not removing it, it is also available to everyone. This way it can never get lost.
Addresses make up the composition of the tangle. When you send a transaction, whether its 0 IOTAs, 1000 IOTAs, has a tag, has data attached to it, everything you send gets stored at the address you send it to, and can be accessed there. Provided that the address has not been pruned in a snapshot, it is now permanently stored there in the tangle.