The user agent and the operating system browser itself and gives the site. Moreover, not only this site, but generally anyone - this is the standard part of the HTTP request, most of the other sites simply do not do anything with this information, or use information about the user agent only to better adapt the layout to its features.
With ip everything is generally trivial, if the request did not contain the sender's ip, the site would not know where to send the response. Therefore, the presence of ip in the request - it is generally the basis of the very possibility to watch sites.
Regarding flash, js, activeX and etc., everything is also simple - on the site page there are scripts using these technologies, and the site just looks at whether these scripts have worked or not. If worked, then the corresponding technology in the browser is enabled.