What is the function of the intermingling of present and past, and of illusion and reality in the play?
The intermingling of present and past, especially in Act2 when Willy is abandoned by his sons in the restaraunt alone, he reflects that Biff once caught him with another woman(adultery) when Biff failed his exam and can't graduate.
Arthur Miller probably did this so the audience can better understand the complexity and instability of Willy Loman's life. Through his flashbacks, we can witness his growing ineffectiveness as a salesman, Biff's discovery of his adulterous affair, and others. It seems that these episodes have had severe negative consequences in Willy's life, so it helps us understand the depth of his despair. We can almost understand, though not necessarily condone, his arguments with his family, his boss, and others.
Willy seems to be quite emotionally unstable as well, and perhaps this is why Miller included episodes of Willy imagining things and/or people are in his presence-it could be an attempt to help us see what is going through his mind, such as his thoughts and motivations, etc.