I've been stumped countless times. It can be demoralizing at times, but I've always found a way through. Some things that help:
- Break the problem down into smaller pieces. Analyze/Attack each piece.
- Try to attack the problem from a different angle.
- Step back, explain the problem to someone. Sometimes just explaining yourself helps highlight your assumptions, and can help you re-arrange your approach.
- Keep at it. Keep trying different things.