(1)
You could (respectfully) ask for feedback on why your application wasn't successful. Were there particular skills they were looking for, or perhaps there were concerns about the fit between role and applicant ("great person, wrong job" happens; just as "great person, wrong time" happens).
Make it clear you are asking in order to guide personal growth (ie. don't give any vibe that you are complaining or contesting their decision) and be sure to thank them for their time if they do give feedback.
Be prepared for the fact the feedback may be quite challenging. Or, you might found that actually you were great, but someone else was absolutely perfect and it was a close decision.
(2)
Apply for other jobs. No job is the be-all and end-all. No company is perfect. The job that makes you happy may be one you didn't expect to love.
(3)
Also keep in mind the bigger and more desirable the company, the more people apply. Chances are you are one of dozens or even hundreds who didn't get the job.