Well much like a movie, they often film scenes that won't really effect the plot if removed. They are taken out in post, and left on the cutting room floor (Figuratively speaking of course).
As for commercials...This is how a network gets money. Big companies Pay the network to air their commercial during a particular show. Depending o the show, the pay out is worth a lot more. If it's a big show that everyone will watch, they pay alot. The Superbowl for example. EVERYONE in america watches it. Everyone will see the commercials...But if it's a , lets say Pilot, or low ratings sitcom, they won't expect as much...
It's all business and marketing. I'm no expert on it, just the basics..lol.