Not only can you not sell a fan game, but you can't even make a fan game legally without the permission of the owners of the Intellectual Property. If you ask and receive explicit permission, then it's OK. Otherwise, it's illegal (then it just depends on whether the owners go after you for it, which usually depends on how visible the game is).
The common misconception that it's OK to make fan games if you don't sell them or make money comes from the fact that, if you don't make money, it's very hard for the owner of the property to actually find you and sue you as an anonymous person on the internet.
Ever heard the phrase "follow the money"? Well, they can. And it will lead to your doorstep.
However, if you change something a little bit (No, this isn't Sonic the Hedgehog, it's Saber the Porcupine!) and just get inspiration from the style and spirit of the game, then not only can you make the game legally, you can sell it, or add advertisement, or whatever you want.
When you violate copyright, your legal liability doesn't depend on whether you made money or not, but the fact that you published it at all (it's based on harm to the copyright holder). There could also be trademark issues, but that's another can of worms.