When the term was first coined, presumably a
rat's ass was the least valuable thing that the speaker could
possibly imagine. If the
subject of a sentence doesn't even "give a rat's ass" about something, the
implication is that he or she certainly wouldn't give more valuable things, such as
concern, or a
second thought to the
object of the sentence. Thus if I were to say, "I don't give a rat's ass about what she thinks", what I really mean is that her thoughts are
absolutely worthless to me, and I wouldn't be willing to trade a rat's ass in exchange for
knowledge of her thoughts, or any chance to talk to her and attempt to
change her thoughts.
There is some debate as to whether a shit might be more worthless than a rat's ass. However, it is generally contended that a flying fuck is not real in even a metaphorical sense; my conclusion is that by saying "I don't give a flying fuck", the implied meaning is "I don't even care enough to make a coherent sentence regarding the topic."