Your mileage may vary of course, but probably the best thing a person can do is get up and walk around. Stand up, leave your cubicle/office/immediate area, and go for a short walk. Maybe clear your head, maybe talk to someone else who's not actively working on something (but do be careful not to bother people who are busy, even if they're not actively typing away), etc.
I mean, if you have some other task you should be doing then of course look into doing that. But a short break now and then does wonders for overall productivity and morale and health, and there's no more appropriate time than waiting for a task to complete.