Ice screws need to be sharp to be placed into the ice, and just like anything with an edge they will get dull over time.
How would one know when to sharpen an ice screw, and once they do need to be sharpened, what is the correct technique to do so?
There exist specialized tools which can assist sharpening. However those generally only work well with a specific brand/type of screw, since the angles of the screw's teeth differ.
(One example is "Lim'Ice" from Petzl, see video https://www.youtube.com/watch?v=BzN7l4JxxpA )
Some shops also have a commercial sharpening service. If a screw is really dull, you can improve it with a diamond file (or even a regular one) by working carefully and following the existing angles.
As to when... it depends. I sharpen my screws when they are visually damaged or when I notice that a screw takes too much effort to set and drive in. It's a trade off between the need to have sharp screws on lead and the risk that I make matters worse by botching the job.
The more you practice the better you get.
The better you are the more often it is worth it.
It's easy to tell when your screws need to be sharpened, because they don't cut as well and get increasingly difficult to place, but with proper maintenance your screws should never get to that point.
The best practice is to sharpen your tools and gear after every climb, even if it doesn't really need it. You don't need to go overboard, but the most serious climbers like Will Gadd will always go over their gear with one or two strokes of a file when putting their gear away. At the very least, gently run your file over each edge to take of any small burrs that aren't obvious from a quick visual inspection. If you wait until your tools are dull before you sharpen them, then you're going to have a difficult time getting them sharp again.
As for how to sharpen your screws, you can purchase specialty ice screw sharpeners, but most people just use a flat file, each screw tip gets filed from two different angles. There are plenty of videos online demonstrating the technique.