What is the best approach to optimize the annealing temperature in a real-time PCR assay when the length of the target sequence and the melting temperature (Tm) of the primers vary between samples?
1) Simplest way to get this under control would be is to use a mastermix that has the "universal annealing" feature. Less involved approach: ThermoFisher has mixes that provide this: https://www.thermofisher.com/tr/en/home/brands/thermo-scientific/molecular-biology/molecular-biology-learning-center/molecular-biology-resource-library/spotlight-articles/pcr-annealing-optimization-universal-annealing.html
2) More involved approach is you can try to add moieties such as Minor Groove Binder to enhance the Tm (thereby enhancing the Ta), or add Locked Nucleic acid modifications. Some software can also give you primers/probes within a temperature range.
Run a gradient of annealing temperatures if your ordinary pcr machine allows this and then choose an annealing temperature that works well 2c above and below that temperature