At Quora, Richard Lueger, former editor, ESL teacher gives a reasonably comprehensive answer to the question of when to use “Do you know ...?” and when to use “Did you know ...?” [reformatted]:
Both are correct but they will usually be used in different
situations....
For example, “Did you know” is commonly used [often with a that-clause] either
- to remind someone [/ make someone aware] of something, eg “Did you know that you have to pay this bill before the end of the month?”
["Did you know we're being inspected next week?"]
or
- to present some interesting fact, eg “Did you know that the Nobel Peace Prize is always awarded in Oslo, Norway?”
Of course, there are other possibilities, such as to ask for
information about the past, eg “Did you know Marmaduke McGillicuddy
when you were at school?”
As for “Do you know,” it’s usually used just to ask for
information, eg “Do you know when the next solar eclipse will be?” /
“Do you know who ate all the cookies?” / “Do you know Marmaduke
McGillicuddy?” [/ “Do you know the thirteen-times table?”]
Sometimes either can be used in a rhetorical question, where the
intent is to give someone a message, not to get an answer, eg “Do/did
you know you’re really stupid?” and “Do/did you know that I’ve always
loved you?”
I'd just add that there is also a pragmatic difference when both options are available. "Did you know that I love you?" is ... I'll say more 'guarded', tentative perhaps, than "Do you know that I love you?" And I don't think this is reasonably considered a rhetorical question!
And "Did you know that you left the keys in the ignition?" is less likely to provoke an altercation than "Do you know that you left the keys in the ignition?" (and certainly less likely than "Do you know that you left the keys in the ignition!"