Social media algorithm, explained
There isn't one algorithm per app. Platforms rank each surface separately (feed, Stories, Explore or For You, search) with different signals; Instagram, for example, explains that its Feed, Stories, Explore and Reels each have their own ranking.
Platforms that publish explanations describe similar ingredients: how a person has interacted with an account before, how people are responding to a post, information about the post itself (format, topic, captions, sounds) and the person's own activity. TikTok says each person's For You feed is unique.
You can't game ranking for long, but you can give it what it measures: content people stop for, finish, save, share and reply to, published consistently for an audience you understand.