Writers use humor in order to "entertain the reader." Authors would put turns, and twist and their stories in order to entertain the reader. They also put humor into their characters that would entertain the reader that would make the reader keep reading.
Hope this helps!