How To Detect Posted Comment in Theme Development?

The easiest and most straight-forward way is to put appropriate code in your wp_list_comments() callback, that outputs a message if a comment is awaiting moderation.

The usual code looks something like this:

<?php if ($comment->comment_approved == '0') : ?>
<em><?php _e('Your comment is awaiting moderation.') ?>

Otherwise, if you’re not using a callback, you can hook into an appropriate action hook, such as pre_comment_content, to inject the same content.