Will github support socket servers?

If I upload an HTML file it will host it on I assume apache? But if I upload a python file that uses socket.bind() will it host that server?

I guess you’re asking about GitHub Pages? That’s only for static websites, nothing that needs to run code on the server side.

How would I get github to do that? Or do I need to pay for a VPS?

Yes, or something else that lets you run code for requests, like container or web application hosting. Which is best depends on what you need.