You need to be specific which airport your flight lands. There are 3 major airports in NY Metropolitan Area, which are JFK and LGA in Queens, and EWR in Elizabeth,/Newark, NJ.
From JFK Airport, you have Airtrain JFK that to take you to Jamaica Station. You need to put $5 MetroCard to exit Airtrain JFK.
Follow sign downstair to Sutphin Blvd-Archer Av Subway Station to MetroCard Vending Machine and choose refill option and put your $2.75 subway fare (add value) or add time (Unlimited Ride 7, 30 days, etc.
Then take Manhattan-bound (E) train to 42nd St-Port Authority Bus Terminal or 34th St-Penn Station depends where your hotel is.
You may also choose to take LIRR train from Jamaica Station to Penn Station.
From LGA Airport:
You buy your MetroCard at Hudson NewsStand or MetroCard Vending Machine. HudsonNewsStand only serves $5.50 or Unlimited MetroCard.
MetroCard Vending Machine at LGA only accept credit, debit, atm card.
You have option of Q70 SBS. Q70 SBS is honor system, so before you get on Q70 SBS bus, you have to use LaGuardia Airport M60/Q70 SBS MetroCard Fare Collector, where you have to press start button, insert your MetroCard to get Proof-of-Payment Receipt. You must keep your POP ticket while riding Q70 SBS and M60 SBS buses because MTA fare inspectors, Eagle Team random check for ticket.
You could take Q70 SBS to 74th St Bus Terminal, which is Jackson Heights-Roosevelt Av.
If you're going to Times Sq, take Manhattan-bound (7) train. If you're going to 34th St, take (E) or (F) train.
If you're at Terminal A aka Marine Air Terminal, you only have Q47 bus, which takes 15-20 minutes to same stop as Q70 SBS.
At your terminal, there are blue orange NJT Ticket Vending Machine and purchase ticket one way $15.00 and Airtrain Newark $5.50 fee is included.
Take Airtrain Newark to Newark Airport Station. You need your NJT ticket to exit Airtrain Newark and you need to keep your ticket for NJT's Northeast Corridor or North Jersey Coast Line to NY Penn Station which is at 33rd St/7th Av.