When you sell your primary residence in the USA you are able to exclude $250,000 in capital gains (or $500,000 if you file jointly). The primary test of whether it is your primary residence is if you lived there 2 of the last 5 years (see more details from the IRS). You can’t repeat this exemption for 2 years (I believe).
It doesn’t matter if you buy another house or not, that exclusion of up to $250,000 is all that can be excluded (you must pay tax on anything above that amount – taxed at capital gains rates for long term gains).
For investment property you can do 1031 exchanges which defers capital gains taxes. Otherwise capital gains will be taxed as you would expect (as capital gains).
When you inherit a house the tax basis will be “stepped up” to the current market rate. So if you then sell your basis isn’t what the owner paid for it, but what it was worth when it was given to you.
Related: Looking for Yields in Stocks and Real Estate – Your Home as an Investment – Home Values and Rental Rates