Cookies are just simple text files which contain two pieces of information; a site name and a unique user ID.
For example, when you visit a site that uses cookies for the first time, a cookie is downloaded onto your device so that the next time you visit that site, your computer checks to see if it has a cookie that is relevant (that is, one containing the site name) and sends the information contained in that cookie back to the site.
The site then ‘knows’ that you have been there before, and in some cases, tailors what pops up on a screen to take account of that fact. This can be helpful to vary content according to whether this is your first ever visit to a site or you visit a particular site a lot.