You can look at it this way:
Yesterday it rained => Here, "yesterday" is an adverb
used to place the said event in time. Since "yesterday" cannot rain, you need the "it" before "rained". You are not qualifying "yesterday" but rather telling the listener what happened yesterday.
Yesterday was cold => Here, "yesterday" is a noun
, which you are describing with an adjective. This is much like saying "the house was cold".
In this case, knowing the adverb from the noun can give you a better idea when it is appropriate to use "it" and when it is not.
Hope that helps.