If you have a multimeter /voltmeter, turn it to AC Volts, 200V + range. In the US you should have a reading of 120V between hot and neutral, 120V between hot and ground, and 0V between neutral and ground. If you look at the outlet, you should see that there is a narrow prong, which is consider the "hot" prong, the wide prong is the "neutral" and the round prong is ground. Don't set your meter to current or you will ruin it. Check this video for the wiring of your outlet. This video will show you how to replace it. and always remember, SAFETY FIRST so you can measure it the way it is, BUT if you work on it....TURN THE POWER OFF.....If in doubt, get a licensed electrician to help you. Hope this helps a bit. Good Luck
If the outlet is the only thing that fails, the problem likely is in one of two places: the wiring at the outlet, or the wiring at the upstream junction. Since you replaced the outlet, I assume there is no wiring problem there. Now you need to locate the upstream junction, which is likely another outlet, but could also be a light switch. Once you located this upstream junction, inspect it for a loose connection.
Find the upstream junction
Method 1 (easiest)
This only works if you know which circuit breaker controls the failed outlet. You would know if you have previoulsy worked on this outlet. Shut off that breaker and find all the outlets and light that is now offline. Then from this list, pick the outlet or light switch that is closest to the failed outlet. That is probably the upstream junction. Probably. You may have to guess again.
Method 2 (easy)
If you don't know which breaker controls this outlet, use the AC Volts settings of a multimeter to probe the failed outlet. Measure hot and ground, since we already know hot-neutral does not work. If the meter moves, even if just a small amount (e.g. 3Volts), you're in luck. Go shut off the breakers one at a time until the voltage disappears. Now you can use method 1.
Theoretically, the low voltage reading could be an induced voltage coming from an ajacent circuit, so the breaker you shut off using this method may be the wrong one. But it's worth a try; just proceed with caution. A cheap analog multi meter is less susceptible to induced voltage than a digital meter.
Method 3 ($)
There are devices you can plug into the failed outlet that would inject a radio signal into the wires that can be picked up by a paired receiver through the wall. This allows you to follow the wiring directly to the upstream junction. Lookup "wiring tracer", "circuit breaker tracer", "wiring tracker", etc.
If you cannot use the methods above, you basically have to guess. Pick the next closest outlet, shut off the breaker, and inspect the wiring in that outlet. If there's nothing wrong, pick another outlet or switch.