1: I was expecting him to sing a song.
2: I was expecting him that he will sing a song.
Is there any rule that states to put ' to ' after 'expecting someone' for something?
Yeah, this one might be annoying for English learners. You have to use sentence 1, as the other one isn't grammatically correct. 'that he will' is in the future tense, and the first sentence is an infinitive so it works after 'expecting someone'. Thinking about it, there must be a rule that specifies that the infinitive must be used after 'expecting someone', every situation I can think of works like that.
Expect ‘licenses’ (permits) both sorts of clause you mention, but you have to follow the syntactic rules for each.
In infinitival clauses the verb is expressed as a ‘marked’ infinitive—the infinitive form preceded by the marker to. The subject is expressed in object form if it is a pronoun. With expect it is omitted altogether if it is the same as the subject of the main clause.
I expect him to sing a song.
meto sing a song.
A ‘content’ clause has the same form as an ordinary declarative clause. The verb is expressed as a finite form; the subject is expressed in subject form if it is a pronoun, and it is not omitted. If the subordinator that is employed it precedes the entire clause, including the subject.
I expect (that) I will sing a song.
I expect (that) he will sing a song.
Note that since a finite (tensed) verb is employed in this clause it must have the tense appropriate to the situation. Your example is a ‘future-in-past’ situation, where the singing is ‘future’ in relationship to the past-tense expectation, so you have to say:
I expected (that) he would sing a song.