If it's an angry song, they might swear to add effect. Some write down their thoughts into their songs because that's the whole point of it, being honest. If they want to swear, they will, cos it lets out all the frustration, I guess. Some just do to be be smart. Not all artists do it though. We swear in life anyway, I don't see the difference if they want to put it in a song.
I think it's because they want to express what they feel. Like eminem, he does it to express anger and such. But some do it just to be cool -.-
They can't find other words that match the beat or the rhyming scheme and at the same time convey the same thought.
art is about expressing urself. swear words are part of it
too show what they really feel and what they think.
Because they're running out of ideas.
Adds emotion if they do it right.