What are cookies and should I accept them?

Most websites you visit nowadays will ask for your cookie preferences. But what does this mean in reality?