Dogs learn to recognize certain cues that tell them it's bedtime. This can include seeing you go through your bedtime routine, responding to specific commands or sounds, and recognizing certain smells right before bedtime.