Study the show for which you will be writing your spec script. Each show has its own style and its own unique characters, so don't stray too far from either the show's style or its characters. You can and should be creative, but your script should follow the show's basic formula and characterizations.
Use proper teleplay structure. Hour-long dramas usually consist of a short teaser and four acts, with each act divided by commercials. Half-hour sitcoms generally have a teaser with two acts and a brief funny ending after the last set of commercials known as the "Tag." Some networks and shows use slightly different structures. Study the specific show you will be writing and follow the structure as closely as you can.
Keep an hour-long drama script between 50 and 60 pages. The general rule in screenwriting is that one page equals one minute of screen time, and most hour-long network dramas run about 45 minutes when you account for the commercial breaks. If your script runs too long, it can be trimmed through editing, but don't write it too short; 50 to 60 pages is the industry norm.
Keep a half-hour sitcom between 22 and 35 pages. Sitcoms run about 22 minutes when you account for the commercials.
Make the teaser interesting and end each act on a dramatic high note or cliffhanger. Writing for networks means working around commercial breaks. Each act must end on a compelling moment to make sure the audience stays through the commercials. If your script doesn't achieve this, it is breaking one of the cardinal rules for writing for network TV.