There is only one train line in Mauritania, linking Nouadhibou with Choum and Zouerat, but it's a tourist attraction itself. The train is said to be the longest one in the world, having over 150 cars and being over 2 kilometers long. It's used to carry iron ore from the Zouerat mine to Nouadhibou harbour.
The train departs daily from Nouadhibou at around 3pm and arrives in Choum for Atar at around 2am the next morning. Check departure times on arrival.
In addition to the few carriages on the train, travel in an iron ore hopper is also possible and advisable, as the passenger car is usually overcrowded and tickets are required. There is also first-class acommodation; first-class seats are limited, but they allow access to a smaller room with bunk beds. It does not necessarily ensure more comfort, though. Ticket price is 1500 ougiyas for second class in the passenger car and travel in a hopper is free. Remember to have a scarf to cover your face, as there is a lot of dust.
There is now one or two carriages with beds, they are not very comfortable but better than nothing and cost 5000 per person. None of the carriages are heated and it gets extremely cold at night. One or two stops are made where kids run up to the doors selling drinks and food, there is no food or drink for sale on the train.
From Choum it's possible to get to Atar with a bush taxi. The journey could take up to eight hours if the vehicle has a breakdown.
You can also ride the train from Choum to Nouadhibou, and the train is then filled with iron ore. The train is supposed to leave at 6PM, but in our case it was 5 hours late. There is a large room with no doors in Choum where you can wait for the train - it is very basic, there is no toilet, but you can buy water and the roof protects you from the sun. When the train was about to arrive, a passengers car took us into the desert, as the train didn't stop in Choum itself. After jumping onto the iron ore wagons, we literally had a few minutes to dig ourselves holes where to sleep without being blown off the train at night. The constant flow of dust and iron is bad for the eyes and lungs, so it's advisable to have eye protection and a scarf. We travelled in May, but at night it was freezing, as there was nowhere to hide. I suspect if you are going the other way and the wagon is empty, it's warmer as you're protected from the wind. After arriving in Nouadhibou, the police may seize your passports and you will need to bribe them to get it back.
Most roadblock/checkpoint police will require a fiche - a document with your data on it name, nationality, itinerary for the journey, etc.. Make sure your nationality is in French to avoid misunderstandings. Brendan van Son prepared a sample fiche template you can find on his website. Have at least 50 fiches for Mauritania when driving Morocco-Mali or Morocco-Senegal. Another dozens for Western Sahara.