Choose a popular television sitcom that is either currently on the air or was a major hit during its heyday. The objective of this exercise in writing spec scripts is to demonstrate that you understand how to live, breathe and sleep a script that is/was commercially successful and to mimic all of the elements that made it work.
Record and/or watch every episode of the TV sitcom that you've chosen as your model. Take copious notes on the characters, their manners of speech, their goals and objectives, and the recurring themes that appear. One of the most popular elements of sitcoms in which opposites are paired, for instance, is the sexual tension of if or when their chemistry will ever ignite and they'll become a couple. Use a stopwatch to make note of how long each "act" is and where the escalating plot points occur.
Create a new premise that has not been previously addressed in the series, but one that is entirely consistent with the personalities of the players, the core theme of the show and all of the episodic content and interactions that have preceded it. Much as your vision might embrace having a character come out of the closet, get killed off in a freak accident or be transferred to a different locale, you need to be mindful of what has made this particular ensemble and the story a success to date and not stray too far outside the existing boundaries.
Write a detailed story outline of what happens in your spec episode prior to drafting the script. Toss this premise into your critique group and pay attention to the feedback you receive. Try to solicit comments from individuals who are already huge fans of the show, and who know these characters as well as--if not better than--you do.
Listen attentively to the dialogue recordings you have made of the show in order to capture the rhythm and vocabulary of the individual players. Make sure that every scene and every line of dialogue is tightly written and either serves to advance the plot or to reveal new layers of character.