It depends on social media. Depending on the options and features they offer, it is sometimes possible to add them in a comment, message or post, simply by selecting the gif icon. It is in the menu, next to that of emojis, images or videos.
On LinkedIn, which wishes to remain a professional social network, adding gifs in posts or comments is only possible by adding a chrome extension or by uploading the gif of your choice.