Wa 'alaykum as-salaam wa rahmatullahi wa barakatahu,
I will give you the answers to such questions and the explanations which are reported by the Holy Prophet (saw) himself. Since the unseen was revealed to him as the Prophet of Allah, the best answer will come from him, as Allah communicated this knowledge through him. Our logic cannot answer something which can only be understood by revelation. This is part of belief in Al-Qadar. I am primarily relying on Sunan Ibn Majah, since I am more familiar with this book of Hadith than the other books.
It was narrated that 'Ali said: “We were sitting with the Prophet (saw) and he had a stick in his hand. He scratched in the ground with it, then raised his head and said: 'There is no one among you but his place in Paradise or Hell has already been decreed.' He was asked: 'O Messenger of Allah, should we not then rely on that?' He said: 'No, strive and do not rely upon that, for it will be made easy for each person to do that for which he was created.' Then he recited: “As for him who gives (in charity) and keeps his duty to Allah and fears Him, And believes in Al-Husna. We will make smooth for him the path of ease (goodness). But he who is a greedy miser and thinks himself self-sufficient. And denies Al-Husna. We will make smooth for him the path for evil.”(92:5-10) (Sahih)
(Sunan Ibn Majah, #78)
'Abdullah bin Abi Mulaikah narrated that his father entered upon 'Aishah and said something to her about the Divine Decree. She said: “I heard the Messenger of Allah (saw) say: 'Whoever says anything about the Divine Decree will be questioned about that on the Day of Resurrection, and whoever does not say anything about it will not be questioned about it.'” (Da'if)
(Sunan Ibn Majah, #84)
NOTE: This Hadith may be considered weak, but the subject-matter is very serious. If the possibility is even there that Allah could question us on it, then we should avoid it when necessary. It is logical to follow this Hadith, since no harm could come if we don't speak about Al-Qadar, and thus are not questioned about it from Allah. Whoever is questioned by Allah on the Day of Judgment, it's not a good sign for that person.
'Amr bin Shu'aib narrated from his father that his grandfather said: “The Messenger of Allah (saw) came out to his Companions when they were disputing about the Divine Decree, and it was as if pomegranate seeds had burst on his face (i.e., it turned red) because of anger. He said: 'Have you been commanded to do this, or were you created for this purpose? You are using one part of the Quran against another part, and this is what led to the doom of the nations before you.'” 'Abdullah bin 'Amr said: “I was never so happy to have missed a gathering with the Messenger of Allah (saw) as I was to have missed that gathering.” (Hasan)
(Sunan Ibn Majah, #85)
NOTE: This shows how much we should refrain from debating about Al-Qadar. Not that you are, but this Hadith demonstrates the seriousness of it.
It was narrated that Suraqah bin Ju'shum said: “I said: 'O Messenger of Allah, is one's deed in that which has already dried of the Pen and what has passed of the Divine Decree, or is it in the future?' He said: 'No, it is in that which is already dried of the Pen and what has passed of the Divine Decree, and each person is facilitated for what he has been created.'” (Sahih)
(Sunan Ibn Majah, #91)
NOTE: This is the answer the Holy Prophet (saw) gave with respect to how you should act with respect to Al-Qadar, things will all happen as they should. We simply have to do our best, and Allah will facilitate our actions.
It was narrated from Abu Hurairah that when the Messenger of Allah (saw) was coming back from the battle of Khaibar, night came and he felt sleepy, so he made camp and said to Bilal: “Keep watch for us tonight.” Bilal prayed as much as Allah decreed for him, and the Messenger of Allah (saw) and his Companions went to sleep. When dawn was approaching, Bilal went to his mount, facing towards the east, watching for the dawn. Then Bilal’s eyes grew heavy while he was leaning on his mount (and he slept). Neither Bilal nor any of his Companions woke until they felt the heat of the sun. The Messenger of Allah (saw) was the first one to wake up. The Messenger of Allah (saw) was startled and said: “O Bilal!” Bilal said: “The same thing happened to me as happened to you. May my father and mother be ransomed for you, O Messenger of Allah!” He said: “Bring you mounts forward a little.” So they brought their mounts forward a little (away from that place). Then the Messenger of Allah (saw) performed ablution and told Bilal to call the Iqamah for prayer, and he led them in prayer. When the Prophet (saw) finished praying, he said: “Whoever forgets a Salah, let him pray it when he remembers, for Allah says: And perform the prayer for My remembrance.”[20:14] He (one of the narrators) said: “Ibn Shihab used to recite this Verse as meaning, ‘when you remember.’”
(Sunan Ibn Majah, #697)
NOTE: The Hadith says, Hazrat Bilal (ra) prayed as much as Allah decreed that he would pray.
There are some Ahadith that show some prayers that reveal some significant points about Al-Qadar and prayers.
It was narrated that Al-Hasan bin ‘Ali said: “My grandfather, the Messenger of Allah (saw), taught me some words to say in Qunut of Witr: Allahumma ‘afini fiman ‘afait, wa tawallani fiman tawallait, wahdini fiman hadait, wa qini sharra ma qadait, wa barik li fima a’tait. Innaka taqdi wa la yuqda ‘alaik, innahu la yudhillu man walait. Subhanaka rabbana tabarakta wa ta’alait (O Allah, pardon me along with those whom You have pardoned, be an ally to me along with those whom You are an ally to, guide me along with those whom You have guided, protect me from the evil that You have decreed, and bless for me that which You have bestowed. For verily You decree and none can decree over You. He whom You support can never be humiliated. Glory is to You, our Lord, You are Blessed and Exalted).” (Sahih)
(Sunan Ibn Majah, #1178)
It was narrated that ‘Abdullah bin Abi Awfa Al-Aslami said: “The Messenger of Allah (saw) came out to us and said: ‘Whoever has some need from Allah or from any of His creation, let him perform ablution and pray two Rak’ah, then let him say: La ilaha illallahul-Halimul-Karim. Subhan-Allahi Rabbil-‘arshil-‘azim. Al-hamdu Lillahi Rabbil-‘Alamin. Allahumma inni as’aluka mujibat rahmatika, wa ‘aza’ima maghfiratika, wal-ghanimata min kulli barrin, was-salamata min kulli ithmnin. As’aluka alla tada’a li dhanban illa ghafartahu, wa la hamman illa farrajtahu, wa la hajah hiya laka irdan illa qadaitaha li (None has the right to be worshipped but Allah, the Forbearing, the Most Generous. Glory is to Allah, the Lord of the Mighty Throne. Praise is to Allah, the Lord of the worlds. O Allah, I ask You for the means of Your mercy and forgiveness, the benefit of every good deed and safety from all sins. I ask You not to leave any sin of mine but You forgive it, or any distress but You relieve it, or any need that is pleasing to You but You meet it). Then he should ask Allah for whatever he wants in this world and in the Hereafter, for it is decreed.” (Da’if)
(Sunan Ibn Majah, #1384)
It was narrated that Abu Khizamah said: “The Messenger of Allah (saw) was asked: ‘Do you think that the medicines with which we treat ourselves, the Ruqyah by which we seek healing, and the means of protection that we seek, change the decree of Allah at all?’ He said: ‘They are part of the decree of Allah.’” (Da’if)
(Sunan Ibn Majah, #3437)
NOTE: This also refers to prayers and their relation with the Divine Decree.
It was narrated that ‘Ubaid bin Rifa’ah Az-Zuraqi said: “Asma’ said: ‘O Messenger of Allah! The children of Ja’far have been afflicted by the evil eye, shall I recite Ruqyah* for them?’ He said: ‘Yes, for if anything were to overtake the Divine decree it would be the evil eye.’” (Sahih)
*Ruqyah: Divine speech recited as a means of curing disease...
(Sunan Ibn Majah, #3510)
NOTE: This does not mean the evil eye overtakes the Divine Decree, it is just a saying that if anything would, the evil eye would have done so. But it doesn't.
It was narrated that Anas said: “The Prophet (saw) said: ‘There is no ‘Adwa* and no omen, but I like Al-Fa’l As-Salih.”**
*’There is no ‘Adwa meaning there is no spread of disease – from the sick person to the healthy person – naturally, as an independent action of the disease. Rather, everything is by the decree of Allah, subject to the will of Allah. See Hadith no. 3540.
**That is, an encouraging sign to do something good.
(Sunan Ibn Majah, #3537)
NOTE: Everything is by the Decree of Allah.
It was narrated from ‘Aishah that the Messenger of Allah (saw) taught her this supplication: “Allahumma inni as’aluka minal-khayri kullihi, ‘ajilihi wa ajilihi, ma ‘alimtu minhu wa ma la a’lam. Wa a’udhu bika minash-sharri kullihi, ‘ajilihiwa ajilihi, ma ‘alimtu minhu wa ma la a’lam. Allahumma inni as’aluka wa nabiyyuka, wa a’udhu bika min sharri ma ‘adha bihi ‘abduka wa nabiyyuka. Allahumma inni as’alukal-jannatah wa ma qarraba ilayha min qawlin aw ‘amalin, wa a’udhu bika minan-nari wa ma qarraba ilayha min qawlin aw ‘amalin, wa as’aluka an taj’al kulla qada’in qadaytahuli khayran (O Allah, I ask You for all that is good, in this world and in the Hereafter, what I know and what I do not know. O Allah, I seek refuge with You from all evil, in this world and in the Hereafter, what I know and what i do not know. O Allah, I ask You for the good that Your slave and Prophet has asked You for, and I seek refuge with You from the evil from which Your slave and Prophet sought refuge. O Allah, I ask You for Paradise and for that which brings one closer to it, in word and deed, and I seek refuge in You from hell and from that which brings one closer to it, in word and deed. And I ask You to make every decree that You decree concerning me good).” (Sahih)
(Sunan Ibn Majah, #3846)
NOTE: The Holy Prophet (saw) taught us here to ask Allah to decree good for us, and not to allow evil to be decreed for us. Prayers have an effect on the Divine Decree. As the next Hadith shows.
It was narrated from Thawban that the Messenger of Allah (saw) said: “Nothing increases one’s life span except righteousness and nothing repels the Divine decree except supplication, and a man may be deprived of provision by a sin that he commits.’” (Da’if)
(Sunan Ibn Majah, #4022)
NOTE: It is obvious from some of the other Ahadith above on prayers, that we can ask Allah to decree good for us rather than evil. The worldly people are given only what Allah already decreed for them (see next Hadith below), while the people who pray to Him are given what they ask for, and are facilitated in that. So there is an obvious effect, otherwise Allah would not have allowed us to pray for a change in the Divine Decree.
‘Abdur-Rahman bin Aban bin ‘Uthman bin ‘Affan narrated that his father said: “Zaid bin Thabit departed from Marwan at mid-day. I said: ‘He has not sent him out at this time of the day except for something he asked.’ So I asked him, and he said: ‘He asked me about some things we heard from the Messenger of Allah (saw) say: “Whoever is focused only on this world, Allah will confound his affairs and make him fear poverty constantly, and he will not get anything of this world except that which has been decreed for him. Whoever is focused on the Hereafter, Allah will settle his affairs for him and make him feel content with his lost, and his provision and worldly gains will undoubtedly come to him.” (Sahih)
(Sunan Ibn Majah, #4105)
It was narrated that Abu Hurairah said, attributing it to the Prophet (saw): “The stronger believer is better and more beloved to Allah than the weak believer, although both are good. Strive to seek that which will benefit you and do not feel helpless. Is something overwhelms you, then say: Qadarullah, wa ma sha’a fa’al (It is the decree of Allah and what He wills He does). And beware of (saying) ‘If only,’ for ‘If only’ opens the door to Satan.” (Sahih)
(Sunan Ibn Majah, #4168)
NOTE: This is important, it shows we shouldn't dwell on things that could have happened, things which already happened, happened because Allah decreed it to happen. We should accept what He decreed and not think we know better than Him. He knows all, being the All-Knowing, what we think does not comprehend the wisdom behind His actions. Everything is a result of His actions only. Therefore, questioning the Divine Decree is definitely a door opened to Shaytan. Non-believers always say, "If only" whenever something happened they didn't like. They dwell on those things and it ruins their life. As Muslims, we should always be at peace with what happens, since we know Allah is the Prime Mover of everything.
I hope this answered your questions. The notes were my own, but they are all based upon what these Ahadith say through mutual support. These are not just in Sunan Ibn Majah, some are mentioned in other sets of Ahadith as well.