My friend and I are going to be traveling through the Provence region of France for 3 days. Our current plan is to go from Barcelona to Nimes for a day, then Nice for a day, day trip to Monaco and end up back in Nice. We would like to leave from Nice on Thursday evening and travel overnight back to Madrid. I´m having a hard time figuring out how to make this trip with the fewest number of connecting trains. Any suggestions?
The problem with your plan is that there are no night trains out of Nice that will work for you.
Are you willing to wait and leave Nice Friday morning? If so, you can depart at 09:33 and be in Port Bou at 18:37. Your route would be Nice Ville-Avignon TGV-Avignon Centre-Narbonne-Perpignan-Port Bou. There is a direct night train that leaves Port Bou at 19:40 and arrives at Madrid-Chamartin at 07:21.
To see this for yourself, use the timetables on the German Rail site. Do separate searches for Nice Ville to Port Bou and Port Bou to Madrid-Chamartin. After you get summary timetables for each search, click on the arrow to the left of the departure time(s) of your choice to see the connecting points.
Have you thought about flying? In 2009 I tried to make a trip from Spain to the south of France and Paris work by train and gave up. We ended up flying from Barcelona to Paris, the airline tickets on Iberia were cheaper than the train ($70 per person). I flew home from Paris,but my friends who stayed longer flew from Paris to Nice for a few days and then back to Paris for their flight home. I don't know what they paid for tickets but I know they felt that it was worth it to fly.
Also, you didn't say when you are going. When I was researching this for our 2009 trip, I came across some information about a high speed rail line that was being constructed between Spain and France. You might want to check to see if it has been completed.