What is a cookie?
A cookie is nothing more than a very small text file. When you visit a website, the server that hosts that site places this file on your computer, typically somewhere within your browser settings files. Once it's on your computer, the cookie acts a lot a rewards card you might have for your local grocery store. You won't get free coffee with it, but the next time you visit that website, the cookie will let the site know who you are and any other relevant information necessary for personalizing your user experience.
The exact information stored on the cookie will vary from site to site, depending on what information is necessary for that particular viewing experience. In most cases, it will identify you in some way. For example, if the site requires a login, the cookie may allow you to remain logged in, or at least let the site remember your username. If you always use the same weather site to get your local forecast, cookies allow that website to remember your location, so you won't have to re-enter it every time.
Sites that use advertising cookies may place information about items you've viewed or purchased, which can then be used to customize the ads you see in the future. Going back to our store card analogy, this is a lot like your grocery store giving you coupons for their special Starbucks coffee beans, because last time you were in you purchased a can of Folgers.