It is generally called a nickname. OED definition:
A (usually familiar or humorous) name which is given to a person, place, etc., as a supposedly appropriate replacement for or addition to the proper name.
There are more specific terms like fanbase nickname (also fandom name in many cases) which is popular in music with singers and music groups, films and actors, literature with authors and books, TV shows, games and sports teams. Fan community nickname is given as a broader term by TV Tropes where many other categories are listed like animes, mangas, comics, toys, video games, radio, theater, web, real life etc. It includes the Redditor example under the "Web Original" category. Some other notable examples within various categories:
- Otaku - a fan of anime or manga
- Marvelite - a fan of Marvel Comics
- Warsies - Star Wars fans
- Potterheads - Harry Potter fans
- Whovians - Doctor Who fans
- Beatlemaniacs - The Beatles fans
- Minecrafters or Minecraftians - Minecraft fans
- Tropers - Tv Tropes fans/users
- Wikipedian - Wikipedia fans/users
The nickname of a student, a member or an alumni of a college/university is a distinct category as it is not about fandom. It is usually just mentioned as a nickname or a colloquial nickname. For example, Cantabrigian article in Wikipedia describes Tab as a nickname:
In the United Kingdom, the nickname "Tab" used by Oxonians (those affiliated with Oxford University) as a term of derision for those affiliated with Cambridge University, is a contraction of Cantabrigian. However, the word "Tab" is used neutrally by students of Cambridge to refer to themselves.
Sometimes, a term can be both a demonym and a nickname. For example, Oxonian can be used both as a demonym for a native or inhabitant of Oxford; and a nickname for a member or graduate of the University of Oxford.
There aren't any rules for the formation of a nickname, just like there aren't rules with many things in English. The formation of an agent noun with the suffixes -er, -or is a simple and common way in many cases like Redditor, Hubber, Trekker, Dragonballer, Ringer, Simmer. There are some other popular formations like using the -y or -sy suffix (usually in plural to represent the community) to form a diminutive form like Warsies, Moonies, Backies, Hearties etc.; -ian suffix to form a noun "one from, belonging to, relating to, or like" like Fandalorians, Holmesians/Sherlockians, Victorians, Floydians, Evertonians, Minecraftians etc.; -head suffix to form a noun "a dedicated fan of something" like Potterheads, Ghostheads, Ledheads/Zepheads, Canuckleheads, Gearheads etc.
In many cases, it is a word (or a modified version of a word) peculiar to or within the jargon of a community, which might not be easily discernible if you are not a fan. The TV Tropes article have many examples of nicknames that can give an idea.