The usual fix for this is to login as the administrator, create a new account and begin moving into your new account.
Because a corrupt profile can do this, it is very important to have spare accounts.
Ok, I have Windows XP with SP2, and I normally have my computer set up with one user account so that it logs in straight away. I was working on it the other day and it randomly restarted, and came up with the classic user log on screen. i.e. where you must enter your username and password, not the one where it gives you a choice of user names. Also, before it loaded this screen, it flashed an unusual blue screen momentarily. I tried to log on using my username, and it started to log me on, made the traditional windows log on noise, but the dialog bow said logging out at the bottom, which is what it did moments later and I found myself back at the classic log on screen. I have tried several times to log on, I have restarted my computer, and I have started it in safe mode and it keeps doing the same thing.
I don't know what I can do apart from completly wiping and reinstalling windows.