¡Hola Fg109!
This is a good question that requires a more complex answer. Sentences like these are where we leave "generally speaking" territory and start getting into the nitty gritty of things!
Looking to see if you're asking a question is the easiest way to go when you're trying to decide whether or not to put an accent on words like these, but the rules are (like so many things in languages!) actually more complex than that. The more in-depth method would involve asking yourself two things:
1. Is there a question involved?
2. Is there an exclamation?
Part 1: Is There a Question Involved?
I say "is there a question involved" because the accent is put on these words when you are asking a direct question (like in the example above, with ¿Cómo te llamas?) and also when dealing with an indirect question. Note that an indirect question in Spanish isn't quite the same as an indirect question in English! The simplest way to put it might be that in Spanish, an indirect question occurs when there is a thinking or speaking verb followed by a structure that could be used in a direct question and that normally starts with a question word.
That probably sounded a bit complicated, but an example might help. We've already established that ¿Cómo te llamas? is a direct question - you're using it to ask someone something. An indirect question would be No sé cómo te llamas "I don't know your name" or No me has dicho cómo te llamas "You haven't told me your name"- we have a thinking or speaking verb followed by a clause that could be used in a question (even if, sometimes, you might change that clause to make the question sound more natural when using it by itself).
So the other sentences you've asked about fall into this category, and work the same way: No me acuerdo cómo hacerlo contains the thinking verb acordarse "to remember" and then the clause cómo hacerlo "how to do it," which you could use in a question (although this is one of those cases where you would probably change the clause a bit to sound more natural if you were using it to ask a direct question).
This sort of construction can take some getting used to for English speakers, but if you keep an eye out for these kinds of things, you will start to get a feel for it!
Part 2: Is There an Exclamation?
Accents are also placed on these sorts of words when an exclamation is being made. For example, ¡Qué sorpresa! "What (a) surprise!"
In instances like this (and also sometimes in instances like those described in Part 1 above), there are some sentences where you could put an accent in OR you could leave it out - it depends on the kind of nuance you want to give your sentence. The original sentence we were talking about is a good example of this.
In Bueno, hijito, como el tiempo vuela… there is no accent because it's a statement, and this isn't meant to be an exclamation: the mother is simply making an observation while reminiscing to her son. This is translated as "Well, son, how time flies..." in English, but the difference might be easier to see if you think of this being more like "Well, son, [it's incredible] the way that time flies..." in tone. If this had been intended to be an exclamation, then an accent would have been required: Bueno, hijito, ¡cómo el tiempo vuela! ("Well, son, how time flies!"). Note, though, that it would actually be more common to change the word order in this kind of exclamation and say ¡Cómo vuela el tiempo!
So for some sentences, you can add the accent in or you can leave it out; it will slightly change the nuance of your phrase. That's why you can find both accented and unaccented versions of many sentences - they have a slightly different emphasis or nuance when they do have the accent compared to when they don't.
I hope that this was helpful! Do let me know if any of the explanation above is unclear.
Saludos,
Liss