All's Well That Ends Well is a cynical comedy that angered the Victorians because of its sexual politics - a determined woman gets what she wants, even to the point of forcing herself on her man. It has often been called the "Unfortunate Comedy" because spectators and critics seem to have a hard time cracking this nut.
Helena, the orphaned daughter of a famous doctor, cures the King of France of a fistula, and as a reward chooses Bertrand de Roussillon, her childhood love, for spouse. Bertrand refuses, claiming the difference in social rank and only relents when the king puts pressure on him. He goes through the marriage ceremony, but then immediately leaves for Florence to fight in a war, without sharing his bed with Helena and thus leaving the marriage unconsummated. He tells Helena he will only regard her as his wife if she manages to get hold of a precious ring that never leaves his finger and can produce offspring that is manifestly his. Two things impossible without his cooperation, so we should read this as "I will never consider you as my wife." But Helena takes him legalistically up on his word. She travels as a pilgrim to Florence, where Bertrand has just returned from the battle field and is courting a young woman, Diana. With the help of Diana and her mother, Helena not only obtains Bertrand's ring, but by a "bed trick" also lies with him in Diana's stead (a trick made possible since due to the presence of the mother in the next room, things have to proceed in the pitch-dark and in utter silence). Back in France, she confronts Bertrand in front of the King, the baby that was the fruit of the bed trick on her arm, and although Bertrand first rather weakly tries to wriggle out of it, he has to receive her (although conditionally) as his wife.
Considering such a story, the title can only be meant ironical: things do seem to end well, but of course they are not well at all. The story Shakespeare uses is from Boccaccio's Decamerone, and concentrates on the successful trick, instead of developing character. It is a romantic comedy with cardboard characters, fun but flat. Shakespeare manages the opposite: his characters are real, three-dimensional people and in his realistic world, tricking people into compliance does not work. People, after all, have their own feelings, their own thoughts and their own likes and dislikes. In other words, this marriage is not going to work. Bertrand's consent is conditional - he wants a good explanation - and of course he will not be happy when he hears he has been tricked into sleeping with Helena.
Why does Bertrand refuse marriage with Helena? Probably because as his childhood companion and a great friend of his mother, she is too close. As a man, he wants to be independent from the two women with whom he has spent his adolescence.
Why is Helena so bent on marrying Bertrand? She is treated as a daughter by the Countess, Bertrand's mother, and she probably wants to put that relation on a legal basis. And of course she wants to get the better of Bertrand, because after his public refusal of marriage her feelings are hurt.
So this is not a flawed play or an imperfect text, as some critics will have it. It is a mature play by a mature author, showing us that in the real world fairy tales don't work.
Resources:
Play text.
Audio file (Librivox)
Tale from the Decamerone (scroll down to Tale 3.9)
Article "Dark Shades in the Unfortunate Comedy"
Article: "The Search for the Lost Husband"