With regarding to "storage space", all that is taken into account is the "bitrate" (data that is transmitted/recorded).
If you have 6MB/s constant bitrate on a camera for example, that is what you'll record (more or less), regardless if you're looking at a 2MP camera or a 4K (8MP), 6MB/s is 6MB/s.
All of the settings combined (bitrate, compression, frames, etc.) will affect the "quality" of the video.
For example: for simple mathematical explanation, if you have a 2MP, h.264 camera at 25FPS, a 2MB/s bitrate, an average scene (not much or no movement or detail) scene it is looking at wants 2MB/s at 100% detail/quality. If the scene suddenly gets more complex, it will need more than the allotted 2MB/s but, since it can't, the stream will be compressed instead and quality will be lost for it to achieve the 2MB/s bitrate.
H.265 can get the same image quality with roughly half the bitrate. So, in the example above with h.265 and 2MB/s bitrate, the camera at 100% detail would only need 1MB/s instead of 2MB/s for the average scene with an extra 1MB/s spare in case the scene becomes more complex; depending on how complex, it's possible the stream will remain at 100% quality.
So, instead of increasing bitrate to retain quality, which would also consume more storage, we change to the h.265 compression; we maintain the same 2MB/s bitrate but, the stream doesn't drop in quality.
Reducing frame rates, I-Frames, resolution and such will lower the total amount of "data" being sent therefore reducing the total required bitrate needed for the image to reach 100% quality, and turn since it will require less bitrate this will also conserve HDD storage space.