I was just reading a series that does this perfectly, and the mechanics are actually pretty clever. Instead of waving a wand and making the solution appear, the magic often creates the clues or alters the investigator's perception. Like, in one story I loved, the detective uses a minor illusion spell to recreate a witness's muddled memory visually, picking out details they couldn't articulate.
It also introduces unique constraints. The magician might need specific components or a quiet moment to cast, which can ratchet up tension if they're being pursued. The solution isn't just 'magic did it'—the detective still has to interpret what the magic reveals, connecting supernatural evidence to a human motive. That blend of esoteric knowledge and classic deduction is what hooks me; it feels like a puzzle with an extra, fantastical layer. The real challenge for the writer is making the magic a tool, not a cheat code, and the best ones nail that balance by integrating it into the investigative procedure itself.