Answered by Shaykh Hamza Karamali, SunniPath Academy Teacher
Is it valid to pray witr behind a Hanafi imam?

In the Name of Allah, Most Merciful and Compassionate
It is valid to pray witr behind a Hanafi imam, since the Hanafi way of praying witr does not include anything that invalidates the prayer in the Shafi’i school.
Ibn Hajar mentions in the Tuhfa that it is superior to pray the witr prayer after waking up from sleep, even if this means missing praying witr with the group. If one wakes up before fajr for the pre-dawn meal (suhur) and prays witr then, it counts as the tahajjud prayer as well, since tahajjud is any prayer prayed at night after waking up from sleep. (Tuhfat al-Muhtaj, 2.229)
And Allah knows best.
Hamza Karamali