We are using DXA 1.7 and would like to populate the components dynamically on a page based on the condition. On a tridion page, what needs to be added (for dynamic CT) and when the dynamic logic need to be populated for a page load.
You can also use the DD4T API to retrieve the component presentation directly from the Broker. You can try to use the GetComponentPresentation. For your conditions to retrieve the template and components, you can use Broker query directly. Complete documentation of the broker query is available HERE.
You will have to mark the component template as dynamic in the CM side and publish it to the broker. You can also use dynamic assembly in the component template, if you would like to have a hybrid behavior.
I can only provide a generic answer since your question does not contain specific scenarios or approaches that you have already evaluated.