The story of Job is a work which addresses some of the questions brought up in your inquiry. Concerning why Hashem does one thing instead of the other, why the righteous suffer and the wicked prosper...
http://www.mechon-mamre.org/e/et/et2740.htmChapter 401 {S} Moreover the LORD answered Job, and said:
2 Shall he that reproveth contend with the Almighty? He that argueth with God, let him answer it. {P}
3 {S} Then Job answered the LORD, and said:
4 Behold, I am of small account; what shall I answer Thee? I lay my hand upon my mouth.
5 Once have I spoken, but I will not answer again; yea, twice, but I will proceed no further. {P}
6 Then the LORD answered Job out of the whirlwind, and said:
7 Gird up thy loins now like a man; I will demand of thee, and declare thou unto Me.
8 Wilt thou even make void My judgment? Wilt thou condemn Me, that thou mayest be justified?
9 Or hast thou an arm like God? And canst thou thunder with a voice like Him?
10 Deck thyself now with majesty and excellency, and array thyself with glory and beauty.
11 Cast abroad the rage of thy wrath; and look upon every one that is proud, and abase him.
12 Look on every one that is proud, and bring him low; and tread down the wicked in their place.
13 Hide them in the dust together; bind their faces in the hidden place.
14 Then will I also confess unto thee that thine own right hand can save thee.
15 Behold now behemoth, which I made with thee; he eateth grass as an ox.
16 Lo now, his strength is in his loins, and his force is in the stays of his body.
17 He straineth his tail like a cedar; the sinews of his thighs are knit together.
18 His bones are as pipes of brass; his gristles are like bars of iron.
19 He is the beginning of the ways of God; He only that made him can make His sword to approach unto him.
20 Surely the mountains bring him forth food, and all the beasts of the field play there.
21 He lieth under the lotus-trees, in the covert of the reed, and fens.
22 The lotus-trees cover him with their shadow; the willows of the brook compass him about.
23 Behold, if a river overflow, he trembleth not; he is confident, though the Jordan rush forth to his mouth.
24 Shall any take him by his eyes, or pierce through his nose with a snare?
25 Canst thou draw out leviathan with a fish-hook? or press down his tongue with a cord?
26 Canst thou put a ring into his nose? or bore his jaw through with a hook?
27 Will he make many supplications unto thee? or will he speak soft words unto thee?
28 Will he make a covenant with thee, that thou shouldest take him for a servant for ever?
29 Wilt thou play with him as with a bird? Or wilt thou bind him for thy maidens?
30 Will the bands of fishermen make a banquet of him? Will they part him among the merchants?
31 Canst thou fill his skin with barbed irons? or his head with fish-spears?
32 Lay thy hand upon him; think upon the battle, thou wilt do so no more.
Chapter 411 Behold, the hope of him is in vain; shall not one be cast down even at the sight of him?
2 None is so fierce that dare stir him up; who then is able to stand before Me?
3 Who hath given Me anything beforehand, that I should repay him? Whatsoever is under the whole heaven is Mine.
4 Would I keep silence concerning his boastings, or his proud talk, or his fair array of words?
5 Who can uncover the face of his garment? Who shall come within his double bridle?
6 Who can open the doors of his face? Round about his teeth is terror.
7 His scales are his pride, shut up together as with a close seal.
8 One is so near to another, that no air can come between them.
9 They are joined one to another; they stick together, that they cannot be sundered.
10 His sneezings flash forth light, and his eyes are like the eyelids of the morning.
11 Out of his mouth go burning torches, and sparks of fire leap forth.
12 Out of his nostrils goeth smoke, as out of a seething pot and burning rushes.
13 His breath kindleth coals, and a flame goeth out of his mouth.
14 In his neck abideth strength, and dismay danceth before him.
15 The flakes of his flesh are joined together; they are firm upon him; they cannot be moved.
16 His heart is as firm as a stone; yea, firm as the nether millstone.
17 When he raiseth himself up, the mighty are afraid; by reason of despair they are beside themselves.
18 If one lay at him with the sword, it will not hold; nor the spear, the dart, nor the pointed shaft.
19 He esteemeth iron as straw, and brass as rotten wood.
20 The arrow cannot make him flee; slingstones are turned with him into stubble.
21 Clubs are accounted as stubble; he laugheth at the rattling of the javelin.
22 Sharpest potsherds are under him; he spreadeth a threshing-sledge upon the mire.
23 He maketh the deep to boil like a pot; he maketh the sea like a seething mixture.
24 He maketh a path to shine after him; one would think the deep to be hoary.
25 Upon earth there is not his like, who is made to be fearless.
26 He looketh at all high things; he is king over all the proud beasts. {P}