RAM is the biggest factor in how many players and mods your server can handle comfortably.
Vanilla and small friend groups
For vanilla or lightly modded survival with up to 6-8 players, 2-4GB is typically enough.
Modded and plugin-heavy servers
Modpacks like All the Mods or a heavily plugin-loaded Paper server benefit from 6-8GB or more. Mods and plugins consume RAM even with nobody online.
Larger communities
For 15+ concurrent players, or a public server running plugins like Dynmap, CoreProtect, or an economy plugin around the clock, plan for 8GB or more.
If you're not sure, you can always upgrade later without losing your world. See Upgrading or Downgrading Your Plan.