There are several ways to calculate slope in qgis using a DEM layer, but how does it actually work? My results show pixels with a slope of 40°+, this seems like a lot (in my DEM, one pixel is 25*25 m). Does it mean that the average slope of the pixel is for example 30° and in reality it could be that the pixel is actually quite flat, but there's a small part of it with really steep slope?
A pixel represents a point. It has no length or width. Slope comes from the relationship between the height of the point and that of neighbouring points, and the distance between them. It is the inverse tangent of the quotient of the difference in height and difference in lateral position
slope = arctan(dy/dx)
In practice, it can be an average or other statistical aggregate of the slope between the point under consideration and several of its neighbours. If you look at the Wikipedia description of image gradient, you can see the mathematics typically involved.
Further, rather than looking at immediately adjacent pixels only, the span of the gradient calculation can be larger. which will generally give a smoother result.