I'm going to start with a short answer.
If your conclusion is a contradiction then your argument can only be valid if the truth of the conclusion is entailed by the truth of the premises.
Longer answer:
An argument is invalid if it takes a form where the premises are true whilst the conclusion is false.
Take Modus Ponens as an example:
If p then q
p
Therefore q
Is it possible to construct an argument which follows the above logical form, but has true premises whilst the conclusion is false?
If it is possible, then Modus Ponens becomes an invalid form of argument. If it isn't possible, then Modus Ponens is a valid argument form.
Take the following argument:
P: X is a square
C: X is a rectangle
If the premise were true, then the conclusion would be true and the argument would be valid.
But what if our premise was actually false?
For example, what if X was actually a triangle?
If X is a triangle
is true, then the conclusion is also false. We would therefore have a false premise which leads to a false conclusion.
We would need the premise to be true and the conclusion to be false for the argument to be invalid. But, this can't happen. If X is a triangle, then the conclusion is false. If X is a square, then the conclusion is true. Either way, we are stuck in a situation where the truth of the premise entails the truth of the conclusion. The argument is therefore valid.
Let's define two terms, of which only one term is directly relevant to the question at hand:
Tautology: something that is true in all possible worlds.
Contradiction : something that is false in all possible worlds.
So, if we have a conclusion that is false in all possible worlds, the argument would only be valid if we have premises that entail the truth of the conclusion if the premises were true. Here is an example (Modus Ponens):
If the grass is green then I will be happy and not happy.
The grass is green.
Therefore, I will be happy and not happy.
This conclusion is clearly contradictory. The argument is valid however, since it follows a valid form of reasoning (MP). If the premises were true, the conclusion would be true. Remember that validity isn't concerned with the actual truth of the premises.