Most of mine come from being eternally curious about the world around me - questioning how things are done, why things are done a certain way.
Ideas tend to strike me when something happens that either makes me happy or excited (which I then want to make repeatable or shareable with the world) or when I see something that makes me sad, or angry (which I then want to make better, or eliminate or prevent).
It can be difficult to sit down with the intent to "have some ideas" which you could translate into startups.
The other thing to note - most of the ideas I come up with go into evernote - never to return. Why? Were they bad ideas, no not really, some are quite interesting. However, they aren't things that I have a strong interest in or a sustained passion for.
No matter what you do to generate your ideas - ensure that they line up with the things in life you can't do without - the things that you'd do even if it wouldn't make you any money.
Regardless of the quality of the idea - if you can't stay excited about in the face of all sorts of difficulty, adversity, and struggle - in an environment of extreme uncertainty and instability - it won't be long before you are thinking of the next idea and wishing you'd never started this one.
The best ideas in my opinion, are the ones that hide among the weeds, on the foggy edges of the thing or things your mind turns to on its own, when given the chance. Opportunities are everywhere - so look near the things that interest you most - those are the most likely to be suited to you.
This may not be an answer that you can immediately apply, but I strongly recommend you to read The Four Steps to the Epiphany, written by Steve Blank.
It's maybe one of the best books I have read on this subject. It will take you through all the steps you need to take and it has a straight forward approach to it.
Here's the link: https://www.amazon.com/Four-Steps-Epiphany-Steve-Blank/dp/0989200507
The best way to think of an idea for a startup is to come up with a solution to a problem that you encounter while doing (or trying to do) something that you're passionate about. For instance, maybe you love traveling but would like a more affordable, local and unique feel to your stay: AirBnB.
Doing it this way helps ensure that:
1) You'll be passionate about your idea, since it relates to your interest. This will help you stick with your startup over time and through difficulties.
2) You'll have a deep knowledge of the field to which the idea is being applied. This means that
A) you will know how to best pivot the idea during development if necessary (always is), and
B) it's less likely that someone else has already thought of your idea and is doing it better.
Keep in mind though that coming up with a good idea, and coming up with an idea that would be good for a startup are two different things. If you don't have a business background, always talk to one or two people that do, in order to hash out whether the idea has scalability and other features that are necessary to make it profitable.
This is a good question.
In addition to the good general answers given before me, I'll try a more practical one. Here are a few methods - they all evolve around finding a solution to a 'pain'/problem that people/businesses have:
1. Work/volunteer in numerous environments and ask yourself: "what can be improved?" or "how can they make more money?"
2. Ask people (or listen to them in daily conversations) what bothers them the most or what they'd like to improve/wish they had ("I wish I had...." or 'I hate it when so and so happens..."
3. Hand around with your nephews (if you have any) - kids aren't limited by reality, and often come up with some great solutions.
4. Check for trends in a specific market (you can use Google Trends and other online tools).
5. Read up on large industries that haven't been disrupted (changed) for a long time (just like Airbnb disrupted the hotel/rental industry).
6. Have ideation sessions with friends or co-founders - you play the 'imagine game' and each of you throw out crazy ideas (I intentionally used the word "crazy", because if you don't start with crazy ideas, you will all be confined to your conventional thinking).
There are many other methods, these are just a few.
I've helped over 300 entrepreneurs with their startups, I'm happy to help you (especially with validating your idea).