Coming from the other side, it's often just as difficult to decide when it is and is not your place to offer advice or criticism. I tend to just keep my mouth shut unless I'm working with people with far less experience, and even then I try to be brief and laconic.
Actuallly, IMO, I don't think it is all that difficult. Just practice and if your partner actually ask for your help or advice, then help them if you can. If you can't help them, then get the Sensei's attention and ask for help.
Now if someone offers me advice, then I will listen. Probably I will say, "yes, thank you." if it was relevant or a good point. If it wasn't a relevant point, then I might say, "yes, good point, however, I was working on doing what sensei was teaching. My understanding was that he wanted us to do this..."
If the advice is particularly not relevant and they insist on it, then I get sensei's attention and let him/her look at what we are doing.
advice I always welcome.
Criticism is always out of place.
If I am with someone who is struggling, then I find usually a good lead with my ukemi and a push or encouragment is much better than stopping and talking.
I find it even now that my 2nd and 1st kyu students will tend to stop and talk a lot at newer students struggling with techniques. So I have been making a practice of when this gets to be a problem of interceding, and take ukemi for the new student to coax them through the technique with almost no word said as an example.
Craig