I happen to be a mafia veteran.
The objective of the game is to outlive the other team, which wins you the game. There are two teams, the townies and the mafia. The townies win when all the mafia members are dead, but the mafia win when there's an equal amount of mafia and town members. These teams are assigned randomly by the game. The mafia are in disguise, so noone knows who they are except for other mafia members.
The objective of the townies then is to find the mafia. You do this through casting suspicion on people, through conversation and through voting on them during the day cycle. The person with the most votes gets put up for the guillotine and have some time to defend themselves. Then after [set amount of time] passes you cast another vote if they're innocent or guilty, and if he's found guilty, he dies. Upon his death his team affiliation gets revealed.
The objective of the mafia is to kill the townies. You do this by avoiding suspicion during the day cycle and then devising a strategy for killing people through the night cycle, and a strategy for how they will act and who they will vote for during the day cycle. You pick someone of the townies to kill, and the next morning their body is found and their team affiliation gets revealed.
The game truly gets fun once you've played it a couple of times and get the basics because the real fun is in the detective work. If you're a townie, keep track of who suspects who and who votes for who. Remember, mafia members know each other so they may accidentally slip up in speech or votes. Then try to see the game from the view of the mafia to predict their strategy. If you're a mafia, look innocent, vote, suspect and act like a townie would unless you can get away with it.
If you're into psychology, think of it as higher order theory of mind made into a game.
If you want to play it as a flash game, try this.
https://store.steampowered.com/app/334230/Town_of_Salem/