Tip #1: Decide the main use of this bike.
This is the most important aspect of buying a bike. It is why you can go to a cyclist's house and find their garage littered with so many bikes. Even though the basic components of a bike are shared -- Frame, Handlebars, Wheels, that doesn't mean they're all the same. So figure out what you'll be using the bike for and find that bike. Remember, a bike that you commute on will not be the same bike for races. You can go even deeper and say, well, what kind of race are you going to do? Hilly? Flat? Time Trial? These will all require a different bike.
Tip #2: Get one that fits.
I typically err on the side of a smaller bike. I do this because it's easier (and arguably way cooler looking) to jack the saddle up or put a 140mm stem on a bike that's a hair too small than it is to shorten a stem to a nubby and slam the saddle to the top tube.
Tip # 3: Search used deals first.
Craigslist, Facebook Marketplace. These are fantastic places to look for a bike that's just a couple years old and steeply discounted. If you can't find what you're looking for, try a bike shop. Better yet, even after buying a used bike, make sure your bike shop gives it a nice once-over.
Tip # 4: Find a bike with the correct gear ratios.
Let's say you found your dream bike. It's a Sagan Edition Tarmac with 53x39 up front and an 11-25 rear cassette. You lock it down, set it up for a ride, go out with your friends, and then you're dropped on the first climb when things get steep. Swapping out cassettes can cost hundreds of dollars and not all cranksets can even go down to compact chainrings. So make sure the bike you're buying has the right gearing.
Tip # 5: Budget some cash for maintenance.
It doesn't matter how cool or perfect your bike is, if the brakes don't work and your chain is skipping, it's not going to be an enjoyable experience. Figure a chain is going to cost somewhere around $30-60 installed and will require a refresh every 2-4 months. Cassettes annually @ $90. Brakes, brake cables, housing, and shifter housing will set you back another $125 / year installed. These are just rough estimates.
Tip #6: Support brands that support cycling.
So this tip might not help you as much in the short run as it might help you in the long run. Cycling is a community sport. It takes bike paths, awareness, respect from drivers, and other infrastructure to make cycling enjoyable.