Calculate Zonal Statistics
Now – having gathered the necessary data – we will generate the statistics using the Zonal Statistics tool:
Processing Toolbox → Raster Analysis → Zonal Statistics
Input your raster layer in the Raster layer parameter as well as your vector layer in the Vector layer containing zones parameter. Next, in the Statistics to calculate parameter, select the stats you want to generate (this will vary in accordance to your project). Once this is complete, run the tool.