Everybody who believes in a God prays from time to time. If you belong to an organized religion, you probably have some fixed prayers for certain occasions, but for some people there are also times when you just feel you must pour your feelings out to God (or gods). So you pray, aloud or silently as your feelings or religion dictate. Most of the time, God doesn't answer, at least not in a way you can say, "God spoke to me and said thus-and-so."
Reminds me of a joke we used to do when I was working on the Unix kernel. We would add a pseudo-device, /dev/god. It's similar to /dev/null: You can write any number of bytes to /dev/null (they are discarded); if you read from /dev/null you get an instant end of file. Like /dev/null, /dev/god will "listen" to whatever you send it. But if you try to read from /dev/god, the read never completes. It's like reading from a terminal (tty) that nobody ever types on. And ioctl directed to /dev/god gets an error, EPERM: you cannot control God.
Still, every once in a while, God will speak to us. Sometimes in answer to an explicit prayer, sometimes out of the blue. But here's the problem: how do you know it is God talking to you? We have lots of voices inside us. Our parents. Teachers. A priest or minister or rabbi or guru. Our own desires, anger, etc.
There are clues. One is the volume of the voice. A loud voice, shouting inside your head, is probably your own feelings -- and often these are negative feelings, anger, hatred, jealousy, fear. There have been a few times in the Bible when God spoke as a voice from heaven -- sometimes quiet, sometimes a voice that resounds like thunder from heaven (Ezek. 1:25; Jer 25:30; Joel 4:16–17; Amos 1:2, etc.) But most of the time, when God speaks to us, it is as a still, small voice.
"And behold, the LORD passed by, and a great and strong wind tore into the mountains and broke the rocks in pieces before the LORD, but the LORD was not in the wind; and after the wind an earthquake, but the LORD was not in the earthquake; and after the earthquake a fire, but the LORD was not in the fire; and after the fire a still small voice."
1 KINGS 19:11-12
So that's one clue: God usually speaks quietly. You have to listen. The shouting voice that overwhelms all other thought is probably not God.
Another clue lies in what the voice is telling you. There are two opposed Hebrew phrases:
Kiddush haShem: Sanctifying The Name
Chillul haShem: Desecrating The Name
"The Name", of course, is the Name of God.
Kiddush haShem is to make God's Name more respected. It includes the Jewish version of martyrdom: not by killing other people, but allowing yourself to be killed rather than do something awful (engage in murder, worship idols).
Chillul haShem is the opposite: to bring God's Name into disrepute. Killing people, torturing people, stealing, other despicable acts, and claiming that God authorized it.
So if that inner voice is telling you to kill, torture, burn crosses on people's lawns, etc., then it is probably not God's voice. The same applies if it is telling you to go demonstrate at military funerals, thanking God for 9/11 and yelling "God hates fags". Because God doesn't hate any of his creatures. He may hate what they do, but he loves all of us.
But if that inner voice is telling you to heal the sick, feed the hungry, help widows and orphans, free political prisoners, etc., then maybe, just maybe, that is God talking to you.