How do the Muslims know when to pray their five times a day?

Good question. they pray when they want to. lol jokes

Fajr: from dawn until sunrise.

Zhur: from noon until midafternoon.

Asr: from midafternoon until sunset.

Magreb: from sunset until full darkness.

Isha: from full darkness until fajr, although it should be offered before midnight.

Most people these days rely on timetables rather than celestial observation. There are a number or electronic devices and computer programs that alert people when it's time to pray. You can find one of the latter at islamicfinder.org.