hey does anyone know how to break into a windows machine on the internet if the IP address is known and let you gain full access to it remotely. More specifically

Knowing the IP address of a machine:

1) how do you know what type of OS it is running?
2) how do you break into it and place some program on that machine which record the keystrokes and send it back to your machine. Exactly how do you break in through an open port? Everyone said to scan for open port yet I cant find any info on how to exactly break in via an open port.

I been testing it with my 2 pc just for fun/hobby, and had no luck. Any help is appreicated, thank you.

A Newbie