This happens because the things you see influence how you feel. Seeing others working hard reminds you to stay focused yourself. This idea is often used in places like libraries and cafes, where people work together and create a productive atmosphere.
When you see others working hard, it can make you feel like you need to work harder too. This is because you feel responsible and experience social pressure. Research shows that people try harder when they see others performing a difficult task. Working in an environment with focused people can help you concentrate better and be more productive. Therefore, try working in a coffee shop or library, where you are surrounded by others who are also working.