Via intense concentration on elaborate self-visualization, repetition of the yidam's mantra, and ritualized hand gestures (mudra), you take on the form, attributes and mind of the yidam for the purpose of transformation - to recognize that one's own mind is not, in fact, different from the all-pervading Buddha-nature.
https://studybuddhism.com/en/tibetan-buddhism/tantra/buddhis...
'One of the most characteristic features of tantra is what we call “deity-yoga,” where we imagine ourselves to be a Buddha-figure. The term is usually translated as “visualize” instead of imagine, although we’re not just dealing with some visual picture of ourselves. I think the word “imagine” is great because we imagine that we really are a Buddha in the form of this figure. Not only do we imagine looking like this figure, but we also imagine speaking, thinking, helping others and experiencing pure enjoyment with all our senses like it does. We also imagine having all its good qualities, such as equal love and compassion for all beings and deep understanding of everything. Of course, to do this successfully we need to have trained beforehand in each of these qualities with sutra practice. Putting them all together with deity-yoga, then, is like a dress rehearsal for actually being a Buddha. By rehearsing now, we build up powerful causes for attaining enlightenment. This extremely efficient method is known as “practicing causes that are the most similar to the result.”'