How do you add text to a carousel of images like here in this example

It depends. There are various carousel plugins and codes available that allow you to achieve something like that. Can you provide a link of where you saw the carousel in that image.

If you are a developer you can use owl carousel which is very good in my opinion.