For international flights, the magic number is usually (but not always) 24 hours. If your flights are less than 24 hours apart, it's a "transit" or a "layover" and it's free; if it's over 24 hours, it's usually "stopover" and you may need to pay extra. Note that these terms are not always used consistently and it's not always 24 hours; I've seen up to 72 hour (3 day) connections on eg. China Southern, especially if one of the legs is not flown daily, while I gather on US domestic flights the window may be as low as 4 hours.
The problem is that most online booking websites are really bad at booking stopovers. If you search for a roundtrip, they only show the "free" connections of less than 24 hours, and if you try to do a multi-city search for LAX-NYC-TXL-LAX, they'll usually do something stupid like add up three rack-rate one-ways and quote you ridiculous prices.
My usual approach is to search for my flights at ITA Matrix (toggle "Advanced routing codes" and try eg.
X:NYC in the outbound routing codes), find a fare where the fare conditions in the small print specifically allow a stopover for a low or zero fee, then take the printout to a travel agent and get them to book it with a stopover added in. For example, searching for a 14-day trip in March, I can find a $1014 fare on United via Newark (EWR) that appears to allow stopovers.
And yes, this is usually far cheaper than booking flights separately. For example, I had to fly Sydney-Tokyo-San Francisco last year, and three separate flights on the same route (3 one-way flights) would have cost me around 3x more than booking a SYD-SFO roundtrip with a stopover in Tokyo.