At EWR a cab should be no problem. Sometimes there is a queue that takes 5-15 mintues, but there are always more cabs pulling up. There is a "dispatcher" who will ask you where you are going, they give you a flat rate, plus tolls & tip. Train to NYC is possible if on a budget, but I've never done it as we live in NJ.
From JFK - whatever you do (I recommend car service or shuttle reservation), make sure to have arrangements done ahead of time. Whenever we've flown into there, the taxi line was huge (that is the line of people waiting for non-existent taxis). Last time, we ended up snagging someone else's car service, (driver complained he'd been looking for his passenger for over an hour so was happy to get the fair), but it cost about twice what a taxi would have.
I think the lack of taxis is because the traffic approaching JFK sucks and people use taxis more in and around that area. So, taxi drivers have other options to pick up fairs. In NJ, taxi use for regular stuff (just getting around, but not to an airport), just isn't as prevalent as most people have cars. And, the traffic around EWR on a bad day is never as bad as the traffic approaching JFK on a regular day.
Therefore, I recommend you not rely on just grabbing a cab at JFK.
The shuttle will be a per person price, so it may work out cheaper to hire a car service. And, pay extra to have the driver park and wait with a sign. It can be chaos outside by the pickup area, and hard to spot the car with your name sign in the window.