Human beings make mistakes. As much as some of us would prefer to deny it, actors too are only human. Forgetting a line happens. Drawing a blank happens. I will say, however, that this is actually not the biggest mistake an actor can make on stage. In fact, it is how a missed line is handled that separates an adequate actor from a good or great one.
When one forgets his next line during a performance, a natural reaction seems to be to stand perfectly still, stare at the actor you were last speaking to, and hope the line will come, or that someone else will save you.
Though understandable, the problem here is that it can draw attention to the fact that one has lost his place. Furthermore, it can also cause other actors on the stage, knowing something is wrong, to follow suit. The result, at worst, can be a collection of frozen silent actors on the stage, looking like a statue garden, as opposed to telling a story.
So what to do should a line elude you? The thing to do is so simple, many people do not think of it; keep acting! As long as you are on stage, you are in character, and that means, with few exceptions, the "deer in the headlights" position is not invoking any sense of drama, character, or story. Not to mention the fact that when you stand there desperately trying to recall what you are to say next, acting skills tend to shut down. You cannot beat your memory into submission, (see previous posts), and when you try, you cannot generally perform well at the same time.
Remain calm. Keep acting. Do something that is in character. Maintain control, and proceed to ad-lib something if you must. Repeat the last thing you said in a different manner, to emphasize your character's point. Or turn your confusion into a part of the character's delivery, depending on the situation. If he is sad, and you forget a line, start to say something, and cry a bit. If angry, use the loss of words to invoke a character who is so angry he has tripped over his words.
Continuing to act through a lapse in memory accomplishes two things. Firstly, 98% of the time the audience will have no clue whatsoever that something is wrong. They will still see a story unfolding, nothing more. Secondly, staying in character and carefully ad-libbing will more quickly bring your mind back into focus, so you can then remember your lost line much faster, and in a more convincing manner.
No one wants to make an error, least of all actors. But once made, extricate yourself gracefully. It can be done, if needs be.