These appear at the end of practically every program or film, listing all or most of the personnel and their roles in the production: actors, writers, camera operators, etc. For Animated Shows, this includes character designers and background artists. This is a relatively new phenomenon in cinema; watch any film made before about 1950 and all the credits (a shorter list than we get today) will be at the start, with just a 'The End' and a studio credit after the last scene. Closing credits takes viewers behind-the-scenes of how the movie/TV Show/animated program is made from start to finish. It's basically "The Making Of..." in a few minutes in movies or in TV Shows, both Live-Action and Animated, 30 seconds or, more or less, a short lecture to show filmmaker wannabes how making a production works.
The increase in the length of credits came about from various Hollywood unions requesting (or demanding, depending on which side of the table you were on) more recognition for the technical professionals that are essential to the production. There are all sorts of insane requirements as to who gets credited for what and why these days. Lawyers also request certain things be added in, just so the audience is absolutely certain that "No Animals Were Harmed during the making of this film" or "this film depicts fictitious events and characters" (for liability reasons, all films are required to have these entries in the credits roll). Vendors and third-parties (such as food services) are also thanked, an idea which would have been unheard of and considered unnecessary 50 years ago (again, union rules and contracts are responsible; they do the work, so they will get the credit).
There are a variety of ways to play with closing credits: A Credits Gag is a joke inserted into the otherwise usual credits and Creative Closing Credits for cases where the presentation of the credits themselves is its own work of art.
May be accompanied by a Credits Medley.
Actors may be credited alphabetically (to eliminate disputes between actors), by order of appearance, or in the same order as the opening credits. Some actors may contractually choose where their names appear. Directors that were dissatisfied with the film (for any reason) could, at one time, have themselves credited under the fictional name of 'Alan Smithee'; but that pseudonym has been retired due to a snafu.
If a given credit seems to have a lot of blank space before and after it, that person's contract probably specifies that their credit must appear alone on the screen for at least one second.
Some actors have a clause written into their contract that they may have their name appear anywhere they wish in the credits; this is said to have saved Gilligan's Island. Bob Denver reportedly heard that Russell Johnson (“The Professor”) and Dawn Wells (“Mary Ann”) were being stuffed into the closing credits (rather than the opening titles) and told the producers to either move his co-stars to the opening titles or put him in the end credits with his co-stars. The studio, fearing that they'd lose Denver's comedic 'star power' and wind up with a dud, hastily complied.
Writers are credited differently, depending on how the work was done: if the writers worked individually on the same project, they're typically credited as '(Name) and (Name)', while writing partnerships are credited as '(Name) & (Name)'. If three writers worked on a project, and two of them worked together, they're usually listed with the partnership first, followed by the individual.
Increasingly, UK networks are making demands on what formats credits can be in - ITV, at one point, deemed that the same name could not appear twice, leading to interesting credits like "Written and produced and directed by".
Modern broadcast practices have seen end credits marginalized and shoved to various parts of the screen. Sometimes, they are shown in a small window as they are supposed to appear, but the sound is muted and the credit scroll itself sped up. Other times, generic credits are shown and flash way too fast to be read. The main purpose of this is so networks can advertise their other programming or cram in more advertising. Notably, several networks and blocks, including Discovery Family, Boomerang, and [adult swim], do not marginalize the credits (except for movies in Discovery Family's case), since these channels/blocks are offshoots of bigger networks, and thus are funded using advertising profits from their parent networks. Video On-Demand and online streaming services do not marginalize end credits, as would be expected.
Public television stations (such as PBS) that rely on sponsorship from outside organisations are bound by thorough and detailed regulations about how long a given sponsor's name can be shown, which sponsors are specifically thanked (and in which order), how much running time the entire sequence can occupy, and even when they're thanked in the titles (typically, regulations require that the 'Viewers Like You' title card is the last to be shown).
Video games with an ending usually have closing credits as well although in that medium, closing credits are not as omnipresent as with movies or TV shows.