Nice makes a great base for your trips to Monaco and Cannes. Travel by either train or bus is frequent and cheap. If you visit any hilltop perched villages, you'll need to take a bus. If you are art lovers, don't miss the Chagall and Matisse museums in Nice. Stroll through Vieux (Old) Nice and check out the market on the Cours Saleya. I didn't get to see it myself, but I've read that the Orthodox cathedral is the best of its kind outside of Russia.
You didn't ask for an opinion about Monaco and Cannes, but I'll give you one anyway. The oceanographic museum and aquarium in Monaco is worth a visit. Otherwise, both Monaco and Cannes are "famous for being famous" and all you'll get for your efforts is to say you've seen how the super rich live. Antibes with its walled old town & market, Picasso museum, and sandy beach makes for a much better day trip.
There is no train service to St-Tropez. The fastest way to get there from Nice is to take a train to St-Raphael and either a bus or a ferry from there. See this page. It's one hour to St-Raphael by train and just under two hours from St-Raphael to St-Tropez by bus.
You might consider stopping at St-Tropez on your way to Marseille rather than backtracking to Nice. From St-Tropez you can take a bus to Toulon and a train from there to Marseille.