Comedy doesn't have to be funny, as anyone who has a. seen 'Twelfth Night' or b. listened to Radio Four's weekday comedy slot will tell you. Comedy is a genre of story, and the basic requirement here are that things turn out well. The Ancient Greeks kicked the whole thing off, and at the heart of the story was an 'agon' or conflict between two characters or groups. One side is dominated by a restrictive belief or obsession. The other represents the life force, truth and freedom. The happy ending comes about when the 'dark' character is forced to see things differently and reconciliation/celebration follow. Good, in other words,triumphs over Evil. Nice thought.
Aristotle called this 'anagnorisis' or recognition, the moment when something not understood before comes clear. This discovery is still central to comedy: eg Bridget Jones discovers that Mark Darcy is really pretty sexy and the awful jumper he was wearing at the Alconbury's Christmas party was an unwanted present.
There are various sub-genres of comedy: romantic comedy being the most obvious. A classic plot is one in which the lovers are kept apart because they are unaware of each other's identity, or even of their own identity. Lost parents or the discovery that one of the characters is a prince or princess can be part of the mix. Shakespeare reinvigorated the form, complicating and enriching the original classical template. But he followed the same pattern: from darkness to light, from disorder to order; from discord to reconciliation.
Love is a frequent theme of comedy, but the 21st century version of the form attempts to 'play it for laughs' even if this goal is sometimes missed. A classic 'type' in this genre is someone who thinks they have the world under control whose life plunges into chaos. Romance and order after chaos/union after separation still dominate eg in ' Four Weddings and a Funeral' in which Charles is united with his True Love when his unfortunate bride (Duckface) is waiting at the altar. The classic of the form in old school Hollywood terms is 'Some Like it Hot' which is full of confusion, cross-dressing and romantic mishaps.
There are huge variations within this form. The key elements are a. we see a group of people in enclosed world with some problems/disconnections; b. it all gets a lot worse; c. light is shed on the matter, truth is revealed, a happy feeling ensues.