I came across the sentence "He visited Chicago many times when he lived in the U.S.", and seemingly the last period is for the ending of the sentence. So is "U.S" a correct abbreviation? This is a sentence from an exam question and I am a bit too curious.
The abbreviation is correctly shown as U.S. A sentence must, as you understand, be ended by a period (full stop), question mark, or exclamation mark. If a sentence is ended by a period which is part of an abbreviation, then that single final period does double duty - it (1) indicates the abbreviation and (2) ends the sentence.
If the sentence is an exclamation or question, then the mark must be added after the period ending the abbreviation:
I want to live in the U.S.!
How long have you lived in the U.S.?
Particularly outside the US, there is a modern tendency to write abbreviations such as US, BBC, UK, etc, without periods, and then the normal rules for ending a sentence are followed:
I often listen to the BBC.
I love the scenery in the UK!
Have you visited the US?
You never end a sentence with a double period. This is written in many of the major style guides. For example, Chicago:
Why, after a lifetime (I trust) of never encountering two periods in a row, do readers suddenly think this might be a good idea? In any case, here are some answers: Don’t ever put two periods in a row. Put one period at the end of a declarative sentence, even if it ends with an abbreviation or a URL. (Questions and exclamations use question marks and exclamation points instead of a period, not in addition to one, even in quotations.)
A sentence should never have two periods at the end. If a sentence ends with an abbreviation followed by a period, do not add an additional period
Whether or not you should use "U.S." or "US" is a matter of style; both are used. In APA, you would use US unless it is being used as an adjective (and — again — you would not use a double period if it was at the end of a sentence).
These prior answers are good but I feel that they may be room for the OP (or subsequent searchers) to still feel that their question isn't being answered: "U.S." (two periods) is the norm in North America; "US" with no periods may be preferred by some style guides (one hopes not in all-caps contexts). In no event is "U.S" with only one period used...except that at the end of a sentence, we don't put double periods. This is not so much a grammar or spelling rule as it is a typographer's convention, much like the (now largely obsolete) placement of a period inside a quotation at the end of a sentence.
So in the quoted sentence, the author was essentially using "U.S." with two periods, and then needed to end the sentence with a period, and those periods got munged into one another. Basically the rule would be "when a sentence ends with an abbreviation that terminates in a period, drop the abbreviation's period before adding the sentence's period." As others have said, if the sentence uses something other than a period, the abbreviation keeps its period.