How to detect them is simply to look at the screen!
There are technically two different things here: a "dead" pixel is always black; a "stuck" pixel is always lit up the same color. Mostly I see the latter as opposed to the former. Good pixels change color and brightness in response to commands from the GPU. A stuck pixel can in principle be stuck on any particular color.