Use a tool like RegShot to take a snapshot of filesystem and registry before and after the ad appearing for the first time, then you can work out what it sets on the computer so that it knows. Then you can undo that change, reload the ad and make another $0.02. You'd probably need to change your IP address too. Then sit back and watch the cash roll in!

If you can compute the exact location on screen where to click then you can send messages to the window using SendMessage to simulate a mouse click. There is a number of ways to read the mouse (the WM_LBUTTONCLICK event, checking the status of the VK_LBUTTON virtual key etc) so you'll need to position the mouse and send a number of messages until it works.

Whether it's legal or not, or in breach or not of their TC's, is something you can (a) lookup beforehand or (b) find out when they send their lawyers after you. Almost certainly they won't be impressed but hey, if they want to pay 2c for each click on an advert then that's their lookout.