If you fly out of Rome to come home, leave Rome as your last destination. In other words go to the farthest point first (wherever that might be) then come back to Rome for the last few days. Even if you decide to fly in and out of Rome, go to the next destination first upon landing then return to Rome for your last few days.
Visiting Rome requires at least 4 nights (your last 4 nights, as explained above). Obviously if you have a love for Roman stuff, then you can stay longer.
You don't have a lot of time to visit many of the places you mention. Sicily alone requires at last 10 days for the bare minimum. Puglia is also vast, and would require 7 to 10 days to visit (if you have a car, since with public transportation Puglia is more challenging).
The beaches near Rome are not the greatest. Sperlonga is not too bad however. Also the Ponziane islands (Ponza and Ventotene) are quaint. Beaches are rocky but the water is gorgeous. No car necessary.
The Amalfi Coast is beautiful and easily reachable from Rome (fast train to Salerno, then ferry or bus to Amalfi, or, if you prefer to stay in Sorrento, train to Naples, then commuter train to Sorrento). Just be aware that the area is very cliffy, therefore more than beaches yo will see small pebbly coves and cliffs. No car necessary or advisable for this area. This area would be the easiest to reach with public transportation.
Puglia has great beaches, but as I said a car would be advisable. You can rent it in Rome or you can fly to Bari immediately upon arrival to Rome on the first leg and rent it there (that would be my choice). If staying in Rome first, then it's faster to take a fast train to Bari.
Sicily requires a separate flight and is too large to visit for the short amount of time you have since you plan to devote at least 4 or 5 nights to Rome. If you do decide to go to Sicily, choose between either the East side (Taormina, Syracuse areas) or the west side (Palermo and Trapani areas). If you stay in Palermo a car is not necessary (bad traffic in Palermo) and you can visit Cefalu by train. Some ruins like Segesta can be seen by bus. Mondello has a nice beach. The Zingaro Natural Marine Reserve near Scopello is great but a car may be necessary. San Vito lo Capo has the most gorgeous beach in Italy (a car necessary).
Sardinia has the greatest beaches in Italy, but a car is absolutely a must and you must fly there also. A week would be a minimum also to visit the basic north area.
Southern Tuscany (Maremma) has nice beaches. It's only 2 hours north of Rome, but a car is also advisable if not necessary.