I recently obtained DEM 16217 SYH-PY 2x16 character screen. Here's the datasheet. As far as I can see, its contrast pin should be connected to voltage source over a potentiometer. How do I pick correct resistance of the potentiometer for this use?
I don't think it makes a whole lot of difference. I've used a 10KΩ linear before which works perfectly well.
You're essentially making a potential divider, connecting your pot between your supply and ground, so as long as it's not too low value that it starts to draw more than a negligible amount of current.
I'm working with RT162-7 based on HD44780 (seems compatible to your DEM 16217 SYH-PY).
Connecting the contrast pin (V0) directly to 0 gives very reasonable contrast, even without a potentiometer or a potential divider.