How you pay the doctor doesn't change if the money paid counts towards the deductible/co-pay. You can pay by cash, check, credit card. Depending on how your doctor's billing works, or what you have negotiated you can pay the day of the appointment, or after the insurance has paid their share. In all cases get the paperwork related to the visit to document what you paid and what you were charged. In some cases the doctors office bills the insurance company directly.
Now if they give you a discount that is where it becomes more complex.
If there is a co-pay, the insurance company is expecting you to pay it. Years ago my wife's employer wanted to wave co-pays when employees children visited the pediatrician. They had to end the policy when it was determined that it put them in violation of the terms and conditions of the agreement between the doctors and the insurance company.
Regarding a deductible for an in-network doctor, the discount negotiated by the insurance company is probably bigger. It isn't unusual to see a $200 cost for a procedure with a negotiated rate of $80.00. That $80 is then used to determine how much you pay. If you haven't reached the deductible you will pay $80, if you have met the deductible you will pay a % of the $80 based on your insurance policy.
of course some procedures won't cost you anything because the insurance company covers the entire cost. Think a basic annual physical, or a flu-shot. But you have to submit it to the insurance company.
It is possible they would give you a discount if you pay cash but it would have to be based on charging you less than the $80 negotiated rate. The problem is that if you submitted it to the insurance company to count as part of the deductible they would ding the doctors office for charging less than the negotiated rate. Of course you could still collect the money you did pay from a flexible spending account or a Health Savings account.
Out-of-network is where discounts become more important. It is to your benefit to negotiate a discount. It saves you money. It also makes meeting your out-of-network deductible more efficient. If you are going out-of-network because the doctor is closer, or more friendly, or whatever you have to realize that many times the insurance company will only credit what you pay towards your out-of-network equal to the negotiated rate. Let's say the doctor you pick charges patients $150 if you pay by credit card, or $100 if you pay cash. Remember if you had gone in-network the cost would have been $80. So the insurance company will let you pay your $100 or $150, but only credit you $80 towards your out-of-network deducible.
Note: you can always submit paperwork to your FSA/HSA for medical procedures no matter if it in-network, out-of-network, or outside of insurance.