Another way cookies are used by web-servers is for tracking the navigation paths that a user follows during his/her visit to the website. This data can be used to profile navigation habits in order to send customized ads, to statistically analyse website’s visits and/or to provide more tailored online services.
Many websites could also make use of “third-party cookies”. These are typically managed by other websites/web-services which content can come from external servers, even though the content itself is viewed in the initial website. Each of these may use their own cookies for the same purposes described above.
Some cookies are necessary for the efficient navigation and are automatically assigned to the visitor; most of them are destroyed after leaving the website (“Session”). Other cookies (“Persistent”) could be kept saved on the browser/device for a longer time; depending on the use they are designed for (i.e. keep track of user’s language preference when he/she visit the website in future).
You can read more about cookies on this Wikipedia article.