Cook onion in oil in a 3 1/2 to 4- quart heavy pot over moderate heat, stirring occasionally, until edges are golden, about 6 minutes. Add ginger and garlic and cook, stirring, 1 minute. Add cumin, coriander, turmeric, salt, and red pepper flakes and cook, stirring, 1 minute.
Stir in water or vegetable broth, cooked potato, carrots, lentils, and coconut milk, then simmer, covered, stirring occasionally, 5 minutes. Simmer, covered, until lentils are tender, about 15 minutes. Season with salt and serve with cilantro sprigs scattered on top.