GAY SEX STORIES NIFTY DUMB JOCK HOW TO
In a drama series, they provide comic relief. The Ditz is written to appear unintentionally funny or humorous. Either way, they're almost always friendly and sociable (or very kindhearted, honest, & humble in some instances), something that can't be said for the polar opposite side of this trope.
In fiction, female ditzes tend to be sweet and naive, while male ditzes tend to be oafish but lovable (whether if they were inverted or not gender-wise). The Ditz is a character whose defining characteristic is profound stupidity or quirkiness.