A few times while bicycle touring:
1. In Russia, several times mostly for curiosity. I would be cycling along the highway and pass a cop otherwise on side with a radar gun. They would motion me to go over. After that, ask all the same curiosity questions: where are you going? What do you like about our roads? What will you do when you get there? Never once asked for ID in those situations.
2. In China, law enforcement told me to get off the main highway and use a side road.
3. In Colorado, cycling a section of Interstate where bikes are allowed (right south of CO/WY border on I-25). Came past a rolled truck as well as two cop cars stopped to attend to a startled but otherwise OK driver. I intended to mostly just cycle past since they otherwise had their hands full. However, just as I came past, the law enforcement officer yelled out to get off the highway. I stopped and explained to him exactly where the "caution bicyclist" signs were found as well as where the sign was to get off I-25. It was all polite. He stopped and thanked me and said he hadn't realized it was allowed.