Use it to emphasize a coincidence when someone appears just as they are mentioned. We were just discussing who should lead the project, and speak of the devil, Sarah walks in.
Pro Tip 2/3
Informal Usage
It's a casual expression, more common in informal conversations than formal settings. We were just laughing about old times and, speak of the devil, our old coach appears.
Pro Tip 3/3
Not Insulting
Despite 'devil', it's not used to offend but can be a playful way to acknowledge someone's arrival. You missed Pete's hilarious joke, and oh, speak of the devil, here's Pete now!