H.264 Advanced Video Coding was a big part in making HD content accessible for television and streaming. It promised identical video quality but at half the bitrate (the amount of data required to encode the video). The main method of H.264 video encoding is called interframe compression. This essentially involves a comparison between previous and future frames to the current frame. If most pixels are virtually the same, then the data from the original frame is intercoded to the new frame. This means that only the pixels that have changed will be stored in the data.
H.265 High Efficiency Video Encoding takes the process further by looking within the same frame for similarities (intraframe compression). It also uses more motion prediction modes and a greater intrerframe compression techniques to keep file sizes smaller without losing video quality.
In the end, H.265 encoding attempts to do the same thing for 4K and 8K resolutions as H.264 encoding did for 1080p HD - identical video quality but at half the bitrate.