Why do bad things happen to good people?...

The question itself says more about people than it does about God. If a person really knows God and has a real and personal relationship with Him then whatever situation (health-wise or otherwise) one finds themselves in, they know that our omnipotent God has purposely allowed or has personally placed them in that situation...good or bad. Why do I say that? Because everyone, believer or atheist, was created for God's good pleasure and fellowship and nothing happens to an individual that God doesn't deem necessary for their individual good or for someone near to them.

Sometimes bad things happen to good people for chastisement, sometimes for refinement and sometimes to implant, grow and refine the faith of those near to them…but always for God’s higher purposes. To the atheist bad things can be allowed to happen by a loving God so that those near to them can see and contrast the futility of life apart from God with something in which to place their hope in the future. A faithful believer near death is God's way of encouraging us to reexamine our own personal relationship with Him in light of our own mortality. If we could plan our own lives, we'd surely never include bad things but God knows what we and those near to us need to strengthen our faith and draw us closer to Him.

Before Mary Queen of Scots, was beheaded by order of her half-sister Queen Elizabeth the 1st, she said "My end is my beginning"...and that is so true. It makes no difference whether you're young, middle-aged or elderly...your end is really the beginning of another life more exciting and more joyous than anything you can imagine, and that life eternally separates us from those earthly things that caused us so much pain.

In the final analysis, the answer as to why bad things happen to good people must be answered emphatically...because God loves and cares for each of us more than we'll ever know and will do whatever it takes to reconcile us to Himself.