No fixed rule
There is no official rule about this. Is entirely until the discretion of the customs office that deals with you at the border as to whether or not you can enter. This applies if you have a visa or if you want to use the Visa Waiver Program (VWP) with an ESTA.
Guilty until proven otherwise
As far as I know, the main directive of the border officer is to assume that he intends to live permanently in the USA. UU. (That is, immigrate there). It is up to you to prove otherwise. The amount of actual "proof" required may be very small. It could be (and usually is) as simple as your verbal statement that you intend to do XYZ while in the US. UU., And intends to leave on a particular date. But, if it was recently (less than 90 days ago) in the USA. UU. For a maximum of 90 days, the likelihood of the border officer expecting him to have more evidence that he is not abusing the WVP to live in US increases.
(With the VWP / ESTA) They may or may not ask to see a ticket to show that they intend to leave. However, you must have one. So if they ask you and you don't have one, expect problems. I would never suggest entering the US. UU. With an ESTA (under the WVP), without an exit ticket. If your departure date is not fixed and you wish to enter with a one-way ticket, purchase a refundable departure ticket and cancel it after entering.
Causes of suspicion
There are scenarios that can increase the chances of triggering guest control suspicions.
For example, if records show that more time has been spent in the US. UU. That outside the US In the US, the officer may decide that he is misusing the VWP system to "live" in the US. UU.
Another example, if you have previously stayed in the USA. UU. For a maximum of 90 days in the VWP, and then return, say, within 12 months after your previous entry (although, it is entirely at the discretion of the officer you are dealing with) this may alert you to interrogate you further. I know of numerous first-hand cases when that second scenario has developed. One was a friend from Sweden who stayed 89 days in the VWP. He returned 11 months later, to visit for another 80 to 90 days (which he told the officer), and was taken aside for 3.5 hours of searching and questions. She lost her connecting flight and had to do everything possible to convince them that she had no intention or desire to emigrate there. Less than a year later he tried to return, as he was denied entry. She now needs a visa for the United States.
In my experience, it is generally best to avoid staying the full 90 days if you plan to return soon (as in the next 3 to 12 months). I have seen numerous cases in which only that was the trigger for reentry problems. I avoid staying more than 80 days, if I plan to return soon. But again It depends entirely on the border officer you have to deal with.
Time in the country of origin
The border officer could also take into account how much he is in his home country, rather than elsewhere. Someone who re-enters the US UU. After recently leaving the US UU., Who has not been in their home country for a significant period, is more likely to look like someone who has weak ties to their home country, and is therefore more likely to try to immigrate to the United States.
The ports may differ
My personal experience is that some ports of entry have officers with significantly stricter attitudes. Others are more relaxed. For example, in my experience, the difference between entering the United States through Florida and New York is like night and day. I have entered by both in many occasions. I have also noticed a significant difference between LAX and SFO upon entering the west coast. Although, I will say that the recent experience (2015 to 2017) at LAX has been more relaxed. I always come and go through the OFS if possible. It is not as different as MIA and FLL (both in Florida), but it is enough to avoid avoiding LAX and NYC if possible. Also, the airport is less busy in SFO, so that's an advantage.
Consequence of entry denied
I understand that if you are denied entry, be they require a visa to return to the United States (and this will be valid for a period of 10 years). Receiving a visa can also be more difficult if you are denied entry at the border. You may have to make great efforts (if possible) to prove the validity of your reasons for visiting the US. UU. And apply for a visa. Caution is recommended.
Simply put, the more you find yourself as someone who has no interest in emigrating to the United States, the better. Which means someone with defined ties to their country of origin (work, business, family, home, etc.) and with a clear travel plan in the USA. UU. And a clear departure date (within 90 days), the greater your chances that the border official will burst it without problems. Dress well, give clear answers, smile, cross all your Ts and mark all your Is, and all is likely to be all right.
In short, it all comes down to the discretion of the border official.