When you've forgotten what you were doing or saying, you use this phrase. It expresses to the listeners that you're trying to remember what to do. Some examples include:
Now, what was I searching for again? Oh yeah, last quarter's budget.
What were we talking about again?
You can also use the phrase "What was (something) again?" with a noun or a noun phrase to ask about things that you've forgotten and need to remember again:
What was his name again?
What was the address of the restaurant again?
When people use this phrase, the question is directed at themselves but of course they also want other people to hear it as well.