Fitting in respectfully comes down to a short universal list plus homework on your specific destination. The universals: greet people before launching into requests, because in most cultures skipping the greeting reads as rude; dress a notch more conservatively than you would at home until you have calibrated; keep your voice down in public; be patient in queues and with bureaucracy; and treat religious sites, elders, and national symbols with visible respect.
The country-specific layer is where research pays. Norms around shoes indoors, punctuality, physical contact between genders, tipping, and directness of speech genuinely differ, and what is warm in one culture is intrusive in another. Some cultures value saving face, so public criticism or hard refusals cause offence; others prize blunt honesty and find vagueness suspicious. A reliable culture guide or your embassy's country notes will flag the big ones.
Beyond that, the best technique is simply observation: watch what locals do in any situation before acting, and when you get it wrong, a smile and sincere apology repairs almost everything. Locals everywhere distinguish easily between a disrespectful visitor and one making an honest effort.