You must earn enough to support yourself, plus any dependents you may have, plus the person you sponsor, and you must have a suitable home in the US for you & your fiancé/spouse (& any child you may have/expect). Living with mommy & daddy is not acceptable. You will need your current year paystubs + last 3 years of US income tax returns to prove you meet support requirements.
You must also prove a valid in-person relationship. No "email pals." You must prove when, where, how often & how long you two have been together in-person, face-to-face, and that the relationship has developed into a committed marital relationship.
For fiancé visa (K-1), you must be a US citizen. IF you meet all requirements, your fiancé waits in his country of citizenship. His visa interview, etc, will be scheduled at the US consulate nearest his home. IF approved, which can take a year or so, depending on his citizenship, he will receive a K-1 visa to enter US. You two must marry within 90 days of his arrival & file for Adjustment of Status. Takes about 6-9 months or so to get a green card. Then he applies for SSN in person at the nearest Social Security Administration office. Takes about 4 weeks to verify immigration status & receive his new Social Security card in the mail. Then he can start looking for work, etc.
If married abroad, you return to US alone, leaving him in his own country, while you apply for CR-1 spouse visa. Typically takes longer than for fiancé visa - expect 1-2 years. After entering US on his visa, he will receive his temporary (conditional) green card within several weeks to a few months. Then he can apply for SSN, etc.
IF you bf is not legally present in US, he must return to his own country, even if you marry. After he completes his bar to reentry, you can file for his spouse visa, but his record of lawbreaking will always be against him. If you two do not reside together during his bar, do not expect to be able to prove a valid, enduring marital relationship. As soon as he returns to his country, he can arrange for your immigration there. You can reside in his country. There is NO way to "legalize" any illegal alien, not even marriage.