not 100% foolproof, but you can make educated guesses
shared hosting often shares ips - reverse lookup might show dozens of sites on same address - also common server headers like “apache on cpanel”
vps? sometimes you’ll see generic cloud provider hostnames in dns or headers - or low resource limits that hint at containerization
dedicated? usually unique ip, custom reverse dns, higher resource availability - and if they’re running weird kernel modules or enterprise control panels, that’s a clue
tools like whois, dig, or even ping/timing patterns can hint at infra - but providers hide this stuff on purpose