Hi Michele, generally if you are hitting hills and running out of power later on, it means you are hitting the hill too fast. If you are riding with other riders and they are leaving you at the end they likely have a better W/KG than you do. If you are riding close to or over your FTP you can only do this for a limited amount of time before running out of power. This is called your W’ (wprime). So assuming you have a power meter on your bike outside you can watch this.
Generally what you need to do is improve your riding power so that you can start easier (below your FTP) and keep up with your friends. If you are going by yourself just slow down in the beginning and ride a lot more hills to practice your pacing.
To improve your general power the most important thing is to ride consistently, meaning if you average 6 hours a week, then do 4-8 hours every week for the entire year (maybe missing a couple weeks). The second thing after consistency is just increase your hours from 6 hour average to 8 hour average for example. And finally make sure after hard rides you fully recover (sleep 8+ hours a night is usually the best).
And if you are trying to increase your power without riding more. This is “black magic” that everyone wants. There are many opinions on how to do this. If you do indoor rides of short duration one HIIT or Tabata workout a week can help. If you can do 1 long ride every week outdoors 3+ hours a week that is ideal. Generally if you are just needing extra power on climbs and you see that you typically do lower RPM on climbs, then doing low RPM (SFR Salite-Forza-Resistenza) can definitly help.
I hope that helps.