Does Allah Answer Prayer?

Why does Allah not accept all my prayers? Which prayers are certainly accepted? How should our prayers be?

We should be careful with the way and adab we make dua.
There are some prayers mentioned in the hadiths that will be accepted.

All prayers are certainly answered

“And when My servants question thee concerning Me, then surely I am nigh. I answer the prayer of the suppliant when he crieth unto Me. So let them hear My call and let them trust in Me, in order that they may be led aright.” (Baqara, 186)
All prayers are acceptable before Allah. They are accepted in three ways:
Either it is accepted exactly in the way we pray or Allah gives the better one than what we ask for. We can’t know and be sure whether our wishes are good and beneficial for us or not. We just think and hope that they are good for us and ask. But Allah knows what we don’t know. Sometimes something we desire has seriously harmful and negative consequences for us which we are incapable of predicting. However we are not capable to see all possible outcomes in the future. But Allah sees what we can’t see. So, thanks to His everlasting mercy, He doesn’t accept our prayer in the exact way we asked. Because that’s the way that may bring us sadness and harm. Or there is another way which is more convenient for us which He will give.
The other way which Allah accepts our prayers is their acceptation in the hereafter. In other words, one who makes dua gets the results and awards of his pray in the hereafter.
It means that, if our prayers aren’t accepted in the same way we asked for, we shouldn’t say that: “My prayer is not accepted.” We should say ”My prayer will be accepted in a better way.” And till it is answered, we should go on our dua.
For instance; a child goes to the doctor and wants him to give a medicine although he has no idea whether that medicine will be any good for him or not. However, the doctor knows what’s wrong with the child. So if the medicine which the child asked for is good for him, the doctor gives. Or if there is a better medicine for him than the one he asked for, the doctor gives it. And if the medicine is harmful for the child’s health, the doctor will never give him.
Likewise, we pray and ask Allah many things we wish. But Allah knows what will be good or bad for us. So His answer to our prayers changes upon our prayer’s situation for us. Allah may not give the thing we wish in this world, but may give in the hereafter. The best is asking for the most beneficial one for us all the time.
“Sins of that who makes dua are forgiven, or he gets (his dua’s) reward immediately or receive his award in the hereafter.” (Daylami)
The main purpose of the prayers should be performing the duty of worship, should not be worldly benefits
Supplication (dua, prayer) is a kind of worship and also a duty of a Muslim. The purpose of the worship can’t be worldly benefits. But if Allah gives worldly benefits as well, it’s from His endless bounties and mercy.
Besides, purposing the worldly pleasures while praying damages the purity of the prayer, that’s why, hinders the acceptance of the prayer. We should take into account that worldly wishes, hardships, sorrows and worries are just the “reasons” of the prayer; not the “exact purposes”. They are the “messengers” notifying the time of the prayer. They remind us that Allah wants us to make dua in that period.
To take one example; in the hadiths, a special prayer called  "rain prayer" is mentioned. When there was lack of rain and drought, Our Beloved Prophet made “rain prayer” and advised us to do in similar situations. So in such conditions, Muslims gather in an open field and make dua all together. The intention of this prayer should be as following:
“O Allah! We understood that by this drought, You remind us that it is time to pray and we should make dua. And we supplicate you to perform our duty in point of being your servant. Our intention is not Your giving rain to us. As a servant, our duty is praying. You are the One who will give us rain when the “time of prayer” ends.