Despite the fact that you have received several answers about why and how memory can fail, most of them seem to ignore reality.
In fact, on real systems, most of these arguments do not describe how everything works. Although they are correct from the point of view that these are the reasons, attempts to allocate memory may fail, they are mostly erroneous in terms of describing how the work usually happens.
Simply, for example, on Linux, if you try to allocate more memory than is available on the system, your allocation will not fail (i.e. you will not get a null pointer or a strd :: bad_alloc exception). Instead, the system will be "over commit", so you get what seems like a valid pointer, but when / if you try to use all this memory, you will get an exception and / or OOM Killer will work, trying to free memory by killing processes that use a lot of memory. Unfortunately, this can just as easily kill a program making a request as other programs (in fact, many of the examples given that try to cause a distribution failure by repeatedly allocating large blocks of memory should probably be among the first to be killed) .
Windows is a little closer to how C and C ++ standards represent things (but only a little). Typically, Windows is configured to expand the page file, if necessary, to satisfy the memory allocation request. This means that as you allocate more memory, the system will be half-crazy with swapping memory around, creating large and large paging files to satisfy your request.
This will ultimately fail, but in a system with lots of disk space, it can run for several hours (most of them mix the data on the disk madly) before this happens. At least on a typical client machine, where the user is actually ... well, using a computer, he will notice that everyone dragged them to a stop and did something to stop him long before the distribution fails.
So, to get a memory allocation that really fails, you usually look for something other than a regular desktop computer. A few examples include a server that runs unattended for several weeks at a time, and loads so easily that no one notices that it crashes a disk, say, for 12 hours in a row, or on a machine with MS-DOS or some RTOS, virtual memory.
Bottom line: you are basically right, and they are mostly wrong. Although, of course, it is true that if you allocate more memory than your computer supports, something should give, it is usually not true that a failure will necessarily happen as prescribed by the C ++ standard - and, in fact, for ordinary desktop computers, which is more exception (pardon pun) than the rule.