How does RNA "know" which DNA strand is the template strand?
Are you asking about introns and exons? Or the "stop" codon? Or something else?
It's the DNA-directed RNA polymerase that has to "know" which strand is the template, and that is determined by the binding of transcription factors that help the polymerase attach to the site where transcription will start.
Separate names with a comma.