The term "nigger" (often misspelled "Niger") is a racial slur with a violent history of oppression. In the U.S., it's not illegal per se—the First Amendment protects hate speech unless it incites imminent violence or constitutes harassment in workplace/school settings (Title VII, Title VI).
However: employers can fire you for it. Schools can discipline. Platforms ban it. Social consequences are swift and severe. In the UK, Canada, and parts of Europe, hate-speech laws can criminalize its public use.
Bottom line: legality varies; decency doesn't. Don't use it.