The question is: What do you have already? You want to find out the ID of a category, but what are you starting out with?
Do you want the categories for a post? Posts can have multiple categories, you know. If so, you’d use get_the_category() to get the array of category objects, and then look at their term_id values. Like so (in the Loop):