Websites can detect that you are using a VPN by checking your IP address. When you use a VPN, your internet traffic is routed through a server operated by the VPN provider. This means that the website you are accessing will see the IP address of the VPN server, rather than your own IP address.
Some websites maintain lists of known VPN IP addresses and can block traffic from those addresses. Others use more sophisticated methods, such as checking the geography of the IP address or analyzing the traffic patterns to try to detect VPN use.
It is worth noting that some VPNs use advanced techniques, such as masking the traffic to make it look like it is coming from a normal internet connection, or using encryption and obfuscation to make it harder to detect. However, these methods are not foolproof and some websites may still be able to detect that you are using a VPN.