Terry Pratchett himself has commented that if you understand ALL the jokes in his books, you must be an extremely strange person. It says a lot about him as a writer of adult books, that so many children read and enjoy his work. It says a lot about J.K.Rowling, as a writer of children's books, that so many adults read and enjoy her work.
Shakespeare, as Sorcha pointed out above, wrote for his plays to be seen performed, not read. They can be dull as dust on the page, especially if you don't understand the text, but performed on stage the whole thing comes alive, even to a 10 year old, even after 500 years, amazing!