Closing costs in general have a breakdown but too some of these can be negotiated. Typically, the buyer will absorb the costs associates with obtaining their loan and attorney fees. The sller typically absorbs the cost of broker commission and of course the excis tax due the government.
But again, some of these may be negotiated as to who will be the bearer of cost.
Do consult with your realtor on these items.
When a property is listed for sale, the owner and their agent agree on a commission percentage. Usually, the listing agent/broker offers cooperating agents/brokers one-half of that amount. (Not always, but usually)
So, at closing, the title company disperses funds to the listing broker who gives his agent their split according to their separate agreement. The title company also sends a check to the buyer's agent/broker and they split that amount according to their agreement.
Closing costs can be paid by whoever agrees to pay them according to the contract. (Keep in mind that some loans will have restrictions)
Ask your realtor to show you a HUD-1 Final Settlement so you can see how the numbers look at closing.
Also ask for a buyer's estimate of expense worksheet so you can see about what amount you may be looking at to come to closing.
Ask your mortgage lender for a Good Faith Estimate. Have them go over the various scenarios with you as the numbers will vary dependent on how you are financing, etc.
All of these services are generally provided free of cost with no obligation by reputable agents and lenders.
Hopefully, if we treat you right, you will come back and do business with us when you are ready to buy.
As to closing costs, there are various costs involved that depend on things like whether you are financing . Usually both the buyer and seller each have certain closing costs, but some of these can also be negotiable.
The best thing to do is find an agent you are comfortable with and who is willing to take the time to explain the whole process to you.