When I was a kid, people used to sing a rhyme that goes,
"Ain't ain't a word,
and you ain't supposed to say it.
Say ain't five times,
and you ain't going to heaven."
Really stupid, I know, but I couldn't resist when I saw your question. To be honest it's just like what Lauren G. said, it replaces aren't, isn't, am not, etc.