Why do difficult-to-learn subjects seem easier in retrospect? Background: I have recently noticed that in class, that after I finished a unit, it seems less difficult than I expected it to be. It has happened in math, physics and electronics.

Is it possible that maybe those units were not even difficult in the first place? That it was just  a matter of perception and first judgement, where you think to yourself "Oh lord, this unit is gonna be hell," and the mind plays along with that all through?

Why do difficult-to-learn subjects seem easier in retrospect?
There are at least two different lines of research that are relevant here. 

Forecasting errors

One large line of research has shown that are pretty bad in forecasting future events. This can be seen, for example, in the stable tendency to overestimate the affective impact of negative as well as positive events in terms of intensity and duration. In other words, if people are facing a situation that will likely be negative (such as an "it will be hell" class or exam), the prediction of their negative affective reaction (How long intense will it be? How long will I suffer?) is stronger than their actual reaction. This tendency has been called the impact bias. Numerous sources of the impact bias have been identified, a good starting point into this research are the (somewhat older) reviews by Wilson and Gilbert (2003, 2005). As an example, one reason for the impact bias in response to negative events is the so-called immune neglect, which refers to people's tendency to underestimate their skill in coping with such events.

Below-average effect

It is also possible to frame the situation in a way that implies a comparison to others: Maybe you expected a difficult class in that you expected to fare worse than your fellow students (and were surprised that you were not).

A line of research has shown that people can be pretty bad in ranking their own skill in comparison to others. Mostly, this surfaces in an above-average effect: Most people think that they are better drivers than others, for example, which is logically impossible. However, research by Justin Kruger (1999), for example, has shown that this holds only for relatively easy tasks. For difficult tasks, this actually turns into a below-average effect. That is, when people think that a task requires much skill (such as a difficult class or exam) most actually think that they are worse than other people. One explanation for this tendency is that people "anchor" their judgment of their own skill only on their introspected self-assessment and fail to consider that it will be difficult for others too (information about ourself comes more easily to the mind, after all).

References

Wilson, T. D., &amp; Gilbert, D. T. (2003). Affective Forecasting. In M. P. Zanna (Ed.), Advances in experimental social psychology (Vol. 35, pp. 345–411). San Diego, CA: Academic Press. 

Kruger, J. (1999). Lake Wobegon be gone! The “below-average effect” and the egocentric nature of comparative ability judgments. Journal of Personality and Social Psychology, 77, 221–232. doi:10.1037/0022-3514.77.2.221

Wilson, T. D., &amp; Gilbert, D. T. (2005). Affective forecasting knowing what to want. Current Directions in Psychological Science, 14, 131–134. doi:10.1111/j.0963-7214.2005.00355.x