I suppose it is difficult to be completely sure and frequently there are several levels of "compreneding" comprehending" and various interpretation for the "true meaning" of concepts and results. I can mention a few good signs: a) you swim like a fish in the notations around the concept/theorem, b) you can prove the theorem by yourself without seeing the proof first, or at least you can prove it after seeing the proof. And for a concept: you can come up with the proofs of the basic results about the concept. c) The concept/theorem looks natural to you and you could even see yourself discovering it. d) you can ask and answer (correctly) to yourself easy questions around the concept/result.
Of course, you should be prepared to situations that you think you have a full understanding and then you discover that you don't and you gain it again and lose it again... Having said that there is a certain feeling when it comes to problems/theorems/concepts of "I got it", the phase transition between not or vaguely understanding and a complete or almost complete understanding. You should be able to indentify this transition. (And problem-solving can give you a good practice.)
One good advice about this is to interact: compare your understanding with fellow students/colleagues, and dont be shy to ask questions.
(I cannot resist mentioning the story about a professor who complained to a colleague: I taught it once and the student did not understand; I taught it for the second time and they did not understand; Then I taught it for the third time and I understood, but they still did not understand.)

