I consider, not necessarily in this order (although I have written these in their importance, least to most):
1) My subjective intention in doing the act. This is easy to change, if I have a bad one I can just change it to a good one.
2) The circumstances and consequences. The when, where, what will result, amount, and so on. The foreseen good consequences must be equal or greater to the bad, but there can be bad.
3) The
nature of the act itself. This is unchanging and so is the most important thing to discern.
All three must be good for the act to be good, if even your intention is bad and the rest are good (such as with almsgiving so as to be praised for it) then you've done wrong to me. Yet even so different judgments can be made for different situations, and there can be multiple good options.
For some of those you linked my answer would be:
Runaway trolley, no pushing (act is murder).
Deliberate infection, no poisoning (act is murder). Perhaps I'd just not treat them, not sure.
Hostage ecologist, no torturing (act is torture, which I consider to be evil).
Life insurance, no murdering.
Lifeboat, I would not throw it. There is no reason to do so that I see.
Concentration, no torturing or killing.
Unfaithful wife, I would attempt to save her due to being bound by marriage.
These are interesting although there are many of them. Some of them cause me to have many questions about causality to have a good answer or any answer so I just skipped that. I need to study more, pray, fast, and so on.
You can learn more from the Scripture, Saints, and other sources of grace to become more just and discern better. Better persons can discern situations better than lesser persons.
Usually I do not have to break down an act like this though, as I know what I need to do, my life is not that complicated.
All the above is my opinion of course.