Assuming CUCI-Lync 8.5 since you failed to specify.
when CUCM does notify csf device about phone presence status of all contacts in buddy list, how CUCM identifies the contact : from the DN, from the CUSM UserId ?
CUCM doesn't notify the CSF device of the presence status. The local CUCI-Lync client uses a Lync API to set the status to Busy when the CSF (or CTI-controlled deskphone) is offhook. Any other users' status comes from Lync and for it to go Busy, they must also have CUCI-Lync running properly. It's a local, client-side data feed.
How Microsoft Lync does match this Contact phone presence with its contacts internally referred UserID.
It doesn't. Again, the CUCI-Lync client will tell the local Lync client to change the local user's status to Busy when the CSF device is offhook. Lync is responsible for replicating that state change to the Lync servers so other users contact lists update accordingly.
Please remember to rate helpful responses and identify helpful or correct answers.