First of all check whether your university or department has a standard response form. This will save you a lot of worries if they have.
Secondly, remember that what I am suggesting below is no more than a suggestion. I would recommend that you check any wording with your head of department to make sure that it doesn't upset anybody.
"I regret to inform you that your work did not reach the standard required for a pass grade."
What follows must depend on what the situation is. Here are a couple of suggestions.
"You are therefore no longer registered as a student at this university."
"If you wish to continue with your studies, you must first arrange to re-sit the xxxx test/examination"
- For Teachers